home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1993 / Internet Info CD-ROM (Walnut Creek) (1993).iso / networking / mail / elm / elm2.4.p23d < prev    next >
Encoding:
Text File  |  1993-08-22  |  96.7 KB  |  3,166 lines

  1. Subject: BETA TEST 2 of elm 2.4 Patch #23d
  2. Summary: This is an official patch for elm 2.4 system.  Please apply it.
  3. Priority: HIGH
  4.  
  5. THIS IS PART 4 OF A 4 PART PATCH
  6.  
  7. THIS PATCH IS IN BETA TEST.  IT IS SUBJECT TO CHANGE.
  8. SAVE YOUR ORIGINAL COPY OF ELM SOURCES SO YOU CAN BACK THIS OUT BEFORE 
  9. APPLYING THE OFFICIAL PATCH
  10.  
  11. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your elm source
  12.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  13.     If you don't have the patch program, apply the following by hand,
  14.     or get patch (version 2.0, latest patchlevel).
  15.  
  16.     After patching:
  17.         sh Configure
  18.         make
  19.         make install
  20.  
  21.     If patch indicates that patchlevel is the wrong version, you may need
  22.     to apply one or more previous patches, or the patch may already
  23.     have been applied.  See the patchlevel.h file to find out what has or
  24.     has not been applied.  In any event, don't continue with the patch.
  25.  
  26.     If you are missing previous patches they can be obtained from our:
  27.     archive server.
  28.  
  29.     Syd Weinstein
  30.     elm@DSI.COM
  31.  
  32.     The patches are available from the dsinc archive server
  33.     Send the following message to archive-server@DSI.COM for
  34.     a list of available patches:
  35.  
  36.     Subject: patch list
  37.     send index elm
  38.  
  39. Index: src/mailmsg1.c
  40. Prereq: 5.6
  41. *** ../elm2.4/src/mailmsg1.c    Sat May  8 16:25:42 1993
  42. --- src/mailmsg1.c    Mon Jul 19 22:46:14 1993
  43. ***************
  44. *** 1,8 ****
  45.   
  46. ! static char rcsid[] = "@(#)$Id: mailmsg1.c,v 5.6 1993/05/08 20:25:33 syd Exp $";
  47.   
  48.   /*******************************************************************************
  49. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  50.    *
  51.    *            Copyright (c) 1988-1992 USENET Community Trust
  52.    *            Copyright (c) 1986,1987 Dave Taylor
  53. --- 1,8 ----
  54.   
  55. ! static char rcsid[] = "@(#)$Id: mailmsg1.c,v 5.7 1993/07/20 02:46:14 syd Exp $";
  56.   
  57.   /*******************************************************************************
  58. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  59.    *
  60.    *            Copyright (c) 1988-1992 USENET Community Trust
  61.    *            Copyright (c) 1986,1987 Dave Taylor
  62. ***************
  63. *** 14,19 ****
  64. --- 14,23 ----
  65.    *
  66.    *******************************************************************************
  67.    * $Log: mailmsg1.c,v $
  68. +  * Revision 5.7  1993/07/20  02:46:14  syd
  69. +  * Handle reply-to in batch mode.
  70. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  71. +  *
  72.    * Revision 5.6  1993/05/08  20:25:33  syd
  73.    * Add sleepmsg to control transient message delays
  74.    * From: Syd
  75. ***************
  76. *** 207,212 ****
  77. --- 211,217 ----
  78.       **/
  79.   
  80.       int  copy_msg = FALSE, is_a_response = FALSE;
  81. +     char *p;
  82.   
  83.       /* First: zero all current global message strings */
  84.   
  85. ***************
  86. *** 215,233 ****
  87.       expanded_to[0] = expanded_cc[0] = expanded_bcc[0] = '\0';
  88.       expanded_reply_to[0] = precedence[0] = expires_days[0] = '\0';
  89.   
  90. !     strcpy(subject, given_subject);        /* copy given subject */
  91. !     strcpy(to, given_to);            /* copy given to:     */
  92. !     strcpy(cc, given_cc);            /*  and so on..       */
  93.   
  94.       /******* And now the real stuff! *******/
  95.   
  96. !     copy_msg=copy_the_msg(&is_a_response); /* copy msg into edit buffer? */
  97.   
  98. !     if (get_to(to, expanded_to) == 0)   /* get the To: address and expand */
  99.         return(0);
  100. !     if ( cc[0] != '\0' )            /* expand out CC addresses */
  101.         build_address(strip_commas(cc), expanded_cc);
  102.   
  103.       /** if we're batchmailing, let's send it and GET OUTTA HERE! **/
  104.   
  105.       if (batch_only) {
  106. --- 220,251 ----
  107.       expanded_to[0] = expanded_cc[0] = expanded_bcc[0] = '\0';
  108.       expanded_reply_to[0] = precedence[0] = expires_days[0] = '\0';
  109.   
  110. !     /* Then: fill in default values for some fields */
  111. !     strcpy(subject, given_subject);
  112. !     strcpy(to, given_to);
  113. !     strcpy(cc, given_cc);
  114. !     if ((p = getenv("REPLYTO")) != NULL)
  115. !       strcpy(reply_to, p);
  116.   
  117.       /******* And now the real stuff! *******/
  118.   
  119. !     /* copy msg into edit buffer? */
  120. !     copy_msg = copy_the_msg(&is_a_response);
  121.   
  122. !     /* get the To: address and expand */
  123. !     if (! get_to(to, expanded_to))
  124.         return(0);
  125. !     /* expand the Cc: address */
  126. !     if (cc[0])
  127.         build_address(strip_commas(cc), expanded_cc);
  128.   
  129. +     /* expand the Reply-To: address */
  130. +     if (reply_to[0])
  131. +       build_address(strip_commas(reply_to), expanded_reply_to);
  132.       /** if we're batchmailing, let's send it and GET OUTTA HERE! **/
  133.   
  134.       if (batch_only) {
  135.  
  136. Index: src/mailmsg2.c
  137. Prereq: 5.30
  138. *** ../elm2.4/src/mailmsg2.c    Sun Jun  6 14:24:48 1993
  139. --- src/mailmsg2.c    Sun Aug 22 23:26:53 1993
  140. ***************
  141. *** 1,8 ****
  142.   
  143. ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 5.30 1993/06/06 17:53:06 syd Exp $";
  144.   
  145.   /*******************************************************************************
  146. !  *  The Elm Mail System  -  $Revision: 5.30 $   $State: Exp $
  147.    *
  148.    *             Copyright (c) 1988-1992 USENET Community Trust
  149.    *             Copyright (c) 1986,1987 Dave Taylor
  150. --- 1,8 ----
  151.   
  152. ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 5.34 1993/08/23 03:26:24 syd Exp $";
  153.   
  154.   /*******************************************************************************
  155. !  *  The Elm Mail System  -  $Revision: 5.34 $   $State: Exp $
  156.    *
  157.    *             Copyright (c) 1988-1992 USENET Community Trust
  158.    *             Copyright (c) 1986,1987 Dave Taylor
  159. ***************
  160. *** 14,19 ****
  161. --- 14,45 ----
  162.    *
  163.    *******************************************************************************
  164.    * $Log: mailmsg2.c,v $
  165. +  * Revision 5.34  1993/08/23  03:26:24  syd
  166. +  * Try setting group id separate from user id in chown to
  167. +  * allow restricted systems to change group id of file
  168. +  * From: Syd
  169. +  *
  170. +  * Revision 5.33  1993/08/10  18:53:31  syd
  171. +  * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
  172. +  * some reads of unitialized memory.
  173. +  * From: vogt@isa.de
  174. +  *
  175. +  * Revision 5.32  1993/08/03  19:28:39  syd
  176. +  * Elm tries to replace the system toupper() and tolower() on current
  177. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  178. +  * collide during linking with routines in isctype.o.  This patch adds
  179. +  * a Configure test to determine whether replacements are really needed
  180. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  181. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  182. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  183. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  184. +  * were dropped.
  185. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  186. +  *
  187. +  * Revision 5.31  1993/07/20  01:47:47  syd
  188. +  * Fix time() declaration
  189. +  * From: Syd via prompt from Dan Mosedale
  190. +  *
  191.    * Revision 5.30  1993/06/06  17:53:06  syd
  192.    * Remove extranious clear
  193.    * From: Chip
  194. ***************
  195. *** 189,201 ****
  196.   #include "headers.h"
  197.   #include "s_elm.h"
  198.   #include <errno.h>
  199. - #include <ctype.h>
  200.   
  201. - #ifdef BSD 
  202. - #undef tolower
  203. - #undef toupper
  204. - #endif
  205.   extern int errno;
  206.   extern char version_buff[];
  207.   
  208. --- 215,221 ----
  209. ***************
  210. *** 331,337 ****
  211.           return(need_redraw);
  212.         }
  213.   
  214. !     chown (filename, userid, groupid);
  215.   
  216.       /* copy the message from standard input */
  217.       if (batch_only) {
  218. --- 351,358 ----
  219.           return(need_redraw);
  220.         }
  221.   
  222. !     chown (filename, -1, groupid);
  223. !     chown (filename, userid, -1);
  224.   
  225.       /* copy the message from standard input */
  226.       if (batch_only) {
  227. ***************
  228. *** 612,618 ****
  229.           mailer, mailerflags, expanded_to, whole_msg_file,
  230.           remove_cmd, whole_msg_file);
  231.       }
  232. !     
  233.       fclose(reply);
  234.   
  235.       if(batch_only) {
  236. --- 633,641 ----
  237.           mailer, mailerflags, expanded_to, whole_msg_file,
  238.           remove_cmd, whole_msg_file);
  239.       }
  240. !     free(whole_msg_file);
  241.       fclose(reply);
  242.   
  243.       if(batch_only) {
  244. ***************
  245. *** 955,961 ****
  246.       **/
  247.   
  248.       char opentype[3];
  249. !     long time(), thetime;
  250.       char *ctime();
  251.       static FILE *filedesc;        /* our friendly file descriptor  */
  252.           char to_buf[VERY_LONG_STRING];
  253. --- 978,984 ----
  254.       **/
  255.   
  256.       char opentype[3];
  257. !     time_t time(), thetime;
  258.       char *ctime();
  259.       static FILE *filedesc;        /* our friendly file descriptor  */
  260.           char to_buf[VERY_LONG_STRING];
  261.  
  262. Index: src/mime.c
  263. Prereq: 5.10
  264. *** ../elm2.4/src/mime.c    Thu May 13 23:56:20 1993
  265. --- src/mime.c    Sun Aug 22 22:55:06 1993
  266. ***************
  267. *** 1,5 ****
  268.   /*******************************************************************************
  269. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  270.    *
  271.    *            Copyright (c) 1988-1992 USENET Community Trust
  272.    *            Copyright (c) 1986,1987 Dave Taylor
  273. --- 1,8 ----
  274. + static char rcsid[] = "@(#)$Id: mime.c,v 5.15 1993/08/23 02:55:05 syd Exp $";
  275.   /*******************************************************************************
  276. !  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
  277.    *
  278.    *            Copyright (c) 1988-1992 USENET Community Trust
  279.    *            Copyright (c) 1986,1987 Dave Taylor
  280. ***************
  281. *** 11,16 ****
  282. --- 14,66 ----
  283.    *
  284.    ******************************************************************************
  285.    * $Log: mime.c,v $
  286. +  * Revision 5.15  1993/08/23  02:55:05  syd
  287. +  * Add missing parens
  288. +  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
  289. +  *
  290. +  * Revision 5.14  1993/08/10  18:53:31  syd
  291. +  * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
  292. +  * some reads of unitialized memory.
  293. +  * From: vogt@isa.de
  294. +  *
  295. +  * Revision 5.13  1993/08/03  19:28:39  syd
  296. +  * Elm tries to replace the system toupper() and tolower() on current
  297. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  298. +  * collide during linking with routines in isctype.o.  This patch adds
  299. +  * a Configure test to determine whether replacements are really needed
  300. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  301. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  302. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  303. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  304. +  * were dropped.
  305. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  306. +  *
  307. +  * Revision 5.12  1993/07/20  02:41:24  syd
  308. +  * Three changes to expand_env() in src/read_rc.c:  make it non-destructive,
  309. +  * have it return an error code instead of bailing out, and add a buffer
  310. +  * size argument to avoid overwritting the destination.  The first is to
  311. +  * avoid all of the gymnastics Elm needed to go through (and occasionally
  312. +  * forgot to go through) to protect the value handed to expand_env().
  313. +  * The second is because expand_env() was originally written to support
  314. +  * "elmrc" and bailing out was a reasonable thing to do there -- but not
  315. +  * in the other places where it has since been used.  The third is just
  316. +  * a matter of practicing safe source code.
  317. +  *
  318. +  * This patch changes all invocations to expand_env() to eliminate making
  319. +  * temporary copies (now that the routine is non-destructive) and to pass
  320. +  * in a destination length.  Since expand_env() no longer bails out on
  321. +  * error, a do_expand_env() routine was added to src/read_rc.c handle
  322. +  * this.  Moreover, the error message now gives some indication of what
  323. +  * the problem is rather than just saying "can't expand".
  324. +  *
  325. +  * Gratitous change to src/editmsg.c renaming filename variables to
  326. +  * clarify the purpose.
  327. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  328. +  *
  329. +  * Revision 5.11  1993/06/10  03:12:10  syd
  330. +  * Add missing rcs id lines
  331. +  * From: Syd
  332. +  *
  333.    * Revision 5.10  1993/05/14  03:56:19  syd
  334.    * A MIME body-part must end with a newline even when there was no newline
  335.    * at the end of the actual body or the body is null. Otherwise the next
  336. ***************
  337. *** 73,79 ****
  338.   #ifdef MIME
  339.   
  340.   #include <errno.h>
  341. - #include <ctype.h>
  342.   #include <sys/stat.h>
  343.   
  344.   int check_for_multipart(filedesc)
  345. --- 123,128 ----
  346. ***************
  347. *** 148,154 ****
  348.           sleep(sleepmsg);
  349.       return(-1);
  350.     }
  351. !   expand_env(Expanded_Filename, Include_Filename);
  352.   
  353.     if (strlen(Content_Type) == 0) {
  354.       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmNoContentTypeGiven,
  355. --- 197,203 ----
  356.           sleep(sleepmsg);
  357.       return(-1);
  358.     }
  359. !   (void) expand_env(Expanded_Filename, Include_Filename, sizeof(Expanded_Filename));
  360.   
  361.     if (strlen(Content_Type) == 0) {
  362.       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmNoContentTypeGiven,
  363. ***************
  364. *** 272,278 ****
  365.       if (!s) return(1);
  366.       while (*s && isspace(*s)) ++s;
  367.       t = buf;
  368. !     while (*s && !isspace(*s) && ((t-buf) < SLEN)) *t++ = *s++;
  369.       EncType = check_encoding(buf);
  370.       if ((EncType == ENCODING_NONE) ||
  371.           (EncType == ENCODING_7BIT) ||
  372. --- 321,328 ----
  373.       if (!s) return(1);
  374.       while (*s && isspace(*s)) ++s;
  375.       t = buf;
  376. !     while (*s && !isspace(*s) && ((t-buf) < (SLEN-1))) *t++ = *s++;
  377. !     *t = '\0';
  378.       EncType = check_encoding(buf);
  379.       if ((EncType == ENCODING_NONE) ||
  380.           (EncType == ENCODING_7BIT) ||
  381.  
  382. Index: src/newmbox.c
  383. Prereq: 5.26
  384. *** ../elm2.4/src/newmbox.c    Thu May 13 23:55:14 1993
  385. --- src/newmbox.c    Sun Aug 22 23:26:54 1993
  386. ***************
  387. *** 1,8 ****
  388.   
  389. ! static char rcsid[] = "@(#)$Id: newmbox.c,v 5.26 1993/05/14 03:55:13 syd Exp $";
  390.   
  391.   /*******************************************************************************
  392. !  *  The Elm Mail System  -  $Revision: 5.26 $   $State: Exp $
  393.    *
  394.    *            Copyright (c) 1988-1992 USENET Community Trust
  395.    *            Copyright (c) 1986,1987 Dave Taylor
  396. --- 1,8 ----
  397.   
  398. ! static char rcsid[] = "@(#)$Id: newmbox.c,v 5.30 1993/08/23 03:26:24 syd Exp $";
  399.   
  400.   /*******************************************************************************
  401. !  *  The Elm Mail System  -  $Revision: 5.30 $   $State: Exp $
  402.    *
  403.    *            Copyright (c) 1988-1992 USENET Community Trust
  404.    *            Copyright (c) 1986,1987 Dave Taylor
  405. ***************
  406. *** 14,19 ****
  407. --- 14,44 ----
  408.    *
  409.    *******************************************************************************
  410.    * $Log: newmbox.c,v $
  411. +  * Revision 5.30  1993/08/23  03:26:24  syd
  412. +  * Try setting group id separate from user id in chown to
  413. +  * allow restricted systems to change group id of file
  414. +  * From: Syd
  415. +  *
  416. +  * Revision 5.29  1993/08/23  02:46:51  syd
  417. +  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
  418. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  419. +  *
  420. +  * Revision 5.28  1993/08/03  19:28:39  syd
  421. +  * Elm tries to replace the system toupper() and tolower() on current
  422. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  423. +  * collide during linking with routines in isctype.o.  This patch adds
  424. +  * a Configure test to determine whether replacements are really needed
  425. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  426. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  427. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  428. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  429. +  * were dropped.
  430. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  431. +  *
  432. +  * Revision 5.27  1993/07/20  15:32:36  syd
  433. +  * no dprint should be at level 0
  434. +  * From: Syd
  435. +  *
  436.    * Revision 5.26  1993/05/14  03:55:13  syd
  437.    * The recent feature addition for the "readmsginc" variable did not modify
  438.    * the output statement that is used when MMDF is defined.  The following
  439. ***************
  440. *** 144,157 ****
  441.   
  442.   /**  read new folder **/
  443.   
  444. - #include <ctype.h>
  445.   #include "headers.h"
  446.   #include "s_elm.h"
  447.   
  448. - #ifdef BSD
  449. - #undef tolower        /* we have our own "tolower" routine instead! */
  450. - #endif
  451.   #include <sys/stat.h>
  452.   #include <errno.h>
  453.   
  454. --- 169,177 ----
  455. ***************
  456. *** 166,172 ****
  457.   
  458.   char *error_description();
  459.   long bytes();
  460. ! #ifndef __STDC__ /* avoid problemswith systems that declare atol as a macro */
  461.   extern void rewind();
  462.   extern long atol();
  463.   #endif
  464. --- 186,192 ----
  465.   
  466.   char *error_description();
  467.   long bytes();
  468. ! #ifndef ANSI_C /* avoid problems with systems that declare atol as a macro */
  469.   extern void rewind();
  470.   extern long atol();
  471.   #endif
  472. ***************
  473. *** 406,412 ****
  474.            rm_temps_exit();
  475.           }
  476.          copyit++;
  477. !        chown(cur_tempfolder, userid, groupid);
  478.          chmod(cur_tempfolder, 0700);    /* shut off file for other people! */
  479.        }
  480.        else {
  481. --- 426,433 ----
  482.            rm_temps_exit();
  483.           }
  484.          copyit++;
  485. !        chown(cur_tempfolder, -1, groupid);
  486. !        chown(cur_tempfolder, userid, -1);
  487.          chmod(cur_tempfolder, 0700);    /* shut off file for other people! */
  488.        }
  489.        else {
  490. ***************
  491. *** 975,981 ****
  492.            Raw(OFF);
  493.            printf(catgets(elm_msg_cat, ElmSet, ElmLengthNESpool,
  494.              "\nnewmbox - length of mbox. != spool mailbox length!!\n"));
  495. !         dprint(0, (debugfile, "newmbox - mbox. != spool mail length"));
  496.           rm_temps_exit();
  497.         }
  498.         if ((mailfile = fopen(cur_tempfolder,"r")) == NULL) {
  499. --- 996,1002 ----
  500.            Raw(OFF);
  501.            printf(catgets(elm_msg_cat, ElmSet, ElmLengthNESpool,
  502.              "\nnewmbox - length of mbox. != spool mailbox length!!\n"));
  503. !         dprint(1, (debugfile, "newmbox - mbox. != spool mail length"));
  504.           rm_temps_exit();
  505.         }
  506.         if ((mailfile = fopen(cur_tempfolder,"r")) == NULL) {
  507.  
  508. Index: src/options.c
  509. Prereq: 5.12
  510. *** ../elm2.4/src/options.c    Sat May  8 16:25:47 1993
  511. --- src/options.c    Tue Aug  3 15:29:15 1993
  512. ***************
  513. *** 1,8 ****
  514.   
  515. ! static char rcsid[] = "@(#)$Id: options.c,v 5.12 1993/05/08 20:25:33 syd Exp $";
  516.   
  517.   /*******************************************************************************
  518. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  519.    *
  520.    *             Copyright (c) 1986,1987 Dave Taylor
  521.    *             Copyright (c) 1988-1992 USENET Community Trust
  522. --- 1,8 ----
  523.   
  524. ! static char rcsid[] = "@(#)$Id: options.c,v 5.16 1993/08/03 19:28:39 syd Exp $";
  525.   
  526.   /*******************************************************************************
  527. !  *  The Elm Mail System  -  $Revision: 5.16 $   $State: Exp $
  528.    *
  529.    *             Copyright (c) 1986,1987 Dave Taylor
  530.    *             Copyright (c) 1988-1992 USENET Community Trust
  531. ***************
  532. *** 14,19 ****
  533. --- 14,71 ----
  534.    *
  535.    *******************************************************************************
  536.    * $Log: options.c,v $
  537. +  * Revision 5.16  1993/08/03  19:28:39  syd
  538. +  * Elm tries to replace the system toupper() and tolower() on current
  539. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  540. +  * collide during linking with routines in isctype.o.  This patch adds
  541. +  * a Configure test to determine whether replacements are really needed
  542. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  543. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  544. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  545. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  546. +  * were dropped.
  547. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  548. +  *
  549. +  * Revision 5.15  1993/07/20  02:41:24  syd
  550. +  * Three changes to expand_env() in src/read_rc.c:  make it non-destructive,
  551. +  * have it return an error code instead of bailing out, and add a buffer
  552. +  * size argument to avoid overwritting the destination.  The first is to
  553. +  * avoid all of the gymnastics Elm needed to go through (and occasionally
  554. +  * forgot to go through) to protect the value handed to expand_env().
  555. +  * The second is because expand_env() was originally written to support
  556. +  * "elmrc" and bailing out was a reasonable thing to do there -- but not
  557. +  * in the other places where it has since been used.  The third is just
  558. +  * a matter of practicing safe source code.
  559. +  *
  560. +  * This patch changes all invocations to expand_env() to eliminate making
  561. +  * temporary copies (now that the routine is non-destructive) and to pass
  562. +  * in a destination length.  Since expand_env() no longer bails out on
  563. +  * error, a do_expand_env() routine was added to src/read_rc.c handle
  564. +  * this.  Moreover, the error message now gives some indication of what
  565. +  * the problem is rather than just saying "can't expand".
  566. +  *
  567. +  * Gratitous change to src/editmsg.c renaming filename variables to
  568. +  * clarify the purpose.
  569. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  570. +  *
  571. +  * Revision 5.14  1993/06/12  05:32:00  syd
  572. +  * fix calling sequence for new argument
  573. +  * From: Syd
  574. +  *
  575. +  * Revision 5.13  1993/06/10  03:07:39  syd
  576. +  * This fixes a bug in the MIME code.  Include_Part() uses expand_env()
  577. +  * to expand the include file name, but since expand_env() is destructive
  578. +  * [it uses strtok()] the file name gets corrupted, and the "Content-Name"
  579. +  * header can contain a bogus value.  The easy fix would be a one-line
  580. +  * hack to Include_Part to use a temporary buffer.  This patch does not
  581. +  * implement the easy fix.  *Every* place expand_env() is used, its side
  582. +  * effects cause problems.  I think the right fix is to make expand_env()
  583. +  * non-destructive (i.e. have it duplicate the input to a temporary buffer
  584. +  * and work from there).  The attached patch modifies expand_env() in
  585. +  * that manner, and eliminates all of the `copy to a temporary buffer'
  586. +  * calls that precede it throughout elm.
  587. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  588. +  *
  589.    * Revision 5.12  1993/05/08  20:25:33  syd
  590.    * Add sleepmsg to control transient message delays
  591.    * From: Syd
  592. ***************
  593. *** 120,129 ****
  594.   #include "save_opts.h"
  595.   #include "s_elm.h"
  596.   
  597. - #ifdef BSD
  598. - #undef tolower
  599. - #endif
  600.   #undef onoff
  601.   #define   onoff(n)    (n == 1? on_name : off_name)
  602.   
  603. --- 172,177 ----
  604. ***************
  605. *** 133,154 ****
  606.   static char *on_name = NULL;
  607.   static char *off_name = NULL;
  608.   static int resort = 0;
  609. ! static char temp[SLEN];    /* needed when an option is run through
  610. !              * expand_env(), because that function
  611. !              * is destructive of the original
  612. !              */
  613. ! static post_cal(f) int f; {strcpy(temp,raw_calendar_file); expand_env(calendar_file,temp);}
  614. ! static post_editor(f) int f; {strcpy(temp,raw_editor); expand_env(editor,temp);}
  615. ! static post_pager(f) int f; {
  616. !     strcpy(temp, raw_pager); expand_env(pager, temp);
  617. !     clear_pages=(equal(pager,"builtin+")||equal(pager,"internal+"));
  618. !     }
  619. ! static post_folder(f) int f; {strcpy(temp,raw_folders); expand_env(folders,temp);}
  620. ! static post_sort(f) int f; {if (f) resort++;}
  621. ! static post_sent(f) int f; {strcpy(temp,raw_sentmail); expand_env(sent_mail,temp);}
  622. ! static post_print(f) int f; {strcpy(temp,raw_printout); expand_env(printout,temp);}
  623. ! static post_menu(f) int f; {headers_per_page=LINES-(mini_menu?13:8);}
  624.   
  625.   opts_menu cfg_opts[] = {
  626.   
  627. --- 181,237 ----
  628.   static char *on_name = NULL;
  629.   static char *off_name = NULL;
  630.   static int resort = 0;
  631. ! static post_cal(f)
  632. ! int f;
  633. ! {
  634. !     (void) expand_env(calendar_file, raw_calendar_file, sizeof(calendar_file));
  635. ! }
  636. ! static post_editor(f)
  637. ! int f;
  638. ! {
  639. !     (void) expand_env(editor, raw_editor, sizeof(editor));
  640. ! }
  641. ! static post_pager(f)
  642. ! int f;
  643. ! {
  644. !     (void) expand_env(pager, raw_pager, sizeof(pager));
  645. !     clear_pages = (equal(pager, "builtin+") || equal(pager, "internal+"));
  646. ! }
  647. ! static post_folder(f)
  648. ! int f;
  649. ! {
  650. !     (void) expand_env(folders, raw_folders, sizeof(folders));
  651. ! }
  652. ! static post_sort(f)
  653. ! int f;
  654. ! {
  655. !     if (f)
  656. !     resort++;
  657. ! }
  658. ! static post_sent(f)
  659. ! int f;
  660. ! {
  661. !     (void) expand_env(sent_mail, raw_sentmail, sizeof(sent_mail));
  662. ! }
  663. ! static post_print(f)
  664. ! int f;
  665. ! {
  666. !     (void) expand_env(printout, raw_printout, sizeof(printout));
  667. ! }
  668. ! static post_menu(f)
  669. ! int f;
  670. ! {
  671. !     headers_per_page = LINES - (mini_menu ? 13 : 8);
  672. ! }
  673.   
  674.   opts_menu cfg_opts[] = {
  675.   
  676. ***************
  677. *** 689,695 ****
  678.         if (sleepmsg > 0)
  679.           sleep((sleepmsg + 1) / 2);
  680.         main_state();
  681. !       sort_aliases(message_count, FALSE);
  682.         main_state();
  683.       }
  684.       ClearLine(LINES-2);        /* clear alias_sort_one_liner()! */
  685. --- 772,778 ----
  686.         if (sleepmsg > 0)
  687.           sleep((sleepmsg + 1) / 2);
  688.         main_state();
  689. !       sort_aliases(message_count, FALSE, FALSE);
  690.         main_state();
  691.       }
  692.       ClearLine(LINES-2);        /* clear alias_sort_one_liner()! */
  693.  
  694. Index: src/read_rc.c
  695. Prereq: 5.16
  696. *** ../elm2.4/src/read_rc.c    Sun May 16 16:59:20 1993
  697. --- src/read_rc.c    Sun Aug 22 22:58:06 1993
  698. ***************
  699. *** 1,8 ****
  700.   
  701. ! static char rcsid[] = "@(#)$Id: read_rc.c,v 5.16 1993/05/16 20:59:14 syd Exp $";
  702.   
  703.   /*******************************************************************************
  704. !  *  The Elm Mail System  -  $Revision: 5.16 $   $State: Exp $
  705.    *
  706.    *            Copyright (c) 1988-1992 USENET Community Trust
  707.    *            Copyright (c) 1986,1987 Dave Taylor
  708. --- 1,8 ----
  709.   
  710. ! static char rcsid[] = "@(#)$Id: read_rc.c,v 5.25 1993/08/23 02:58:04 syd Exp $";
  711.   
  712.   /*******************************************************************************
  713. !  *  The Elm Mail System  -  $Revision: 5.25 $   $State: Exp $
  714.    *
  715.    *            Copyright (c) 1988-1992 USENET Community Trust
  716.    *            Copyright (c) 1986,1987 Dave Taylor
  717. ***************
  718. *** 14,19 ****
  719. --- 14,100 ----
  720.    *
  721.    *******************************************************************************
  722.    * $Log: read_rc.c,v $
  723. +  * Revision 5.25  1993/08/23  02:58:04  syd
  724. +  * Call to expand_env for pager should be call to do_expand_env.
  725. +  * temp_dir not initialized.
  726. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  727. +  *
  728. +  * Revision 5.24  1993/08/10  18:49:32  syd
  729. +  * When an environment variable was given as the tmpdir definition the src
  730. +  * and dest overlapped in expand_env.  This made elm produce a garbage
  731. +  * expansion because expand_env cannot cope with overlapping src and
  732. +  * dest.  I added a new variable raw_temp_dir to keep src and dest not to
  733. +  * overlap.
  734. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  735. +  *
  736. +  * Revision 5.23  1993/08/03  19:28:39  syd
  737. +  * Elm tries to replace the system toupper() and tolower() on current
  738. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  739. +  * collide during linking with routines in isctype.o.  This patch adds
  740. +  * a Configure test to determine whether replacements are really needed
  741. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  742. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  743. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  744. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  745. +  * were dropped.
  746. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  747. +  *
  748. +  * Revision 5.22  1993/08/03  18:57:21  syd
  749. +  * default_weedlist() can't use pmalloc, because weedout() calls free when
  750. +  * it encounters *clear-weed-list*.
  751. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  752. +  *
  753. +  * Revision 5.21  1993/08/03  18:55:42  syd
  754. +  * Spaces in weedout strings wasn't preserved ("From " became "From").
  755. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  756. +  *
  757. +  * Revision 5.20  1993/07/20  02:41:24  syd
  758. +  * Three changes to expand_env() in src/read_rc.c:  make it non-destructive,
  759. +  * have it return an error code instead of bailing out, and add a buffer
  760. +  * size argument to avoid overwritting the destination.  The first is to
  761. +  * avoid all of the gymnastics Elm needed to go through (and occasionally
  762. +  * forgot to go through) to protect the value handed to expand_env().
  763. +  * The second is because expand_env() was originally written to support
  764. +  * "elmrc" and bailing out was a reasonable thing to do there -- but not
  765. +  * in the other places where it has since been used.  The third is just
  766. +  * a matter of practicing safe source code.
  767. +  *
  768. +  * This patch changes all invocations to expand_env() to eliminate making
  769. +  * temporary copies (now that the routine is non-destructive) and to pass
  770. +  * in a destination length.  Since expand_env() no longer bails out on
  771. +  * error, a do_expand_env() routine was added to src/read_rc.c handle
  772. +  * this.  Moreover, the error message now gives some indication of what
  773. +  * the problem is rather than just saying "can't expand".
  774. +  *
  775. +  * Gratitous change to src/editmsg.c renaming filename variables to
  776. +  * clarify the purpose.
  777. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  778. +  *
  779. +  * Revision 5.19  1993/06/10  03:08:38  syd
  780. +  * I have been repetedly crashing elm 2.4.22 until I discovered that a
  781. +  * test for failing to open the system elmrc file is mising. This could
  782. +  * usefully be added in read_rc.c. Version info and patch follows:
  783. +  * From: "C.R. Ritson" <C.R.Ritson@newcastle.ac.uk>
  784. +  *
  785. +  * Revision 5.18  1993/06/10  03:07:39  syd
  786. +  * This fixes a bug in the MIME code.  Include_Part() uses expand_env()
  787. +  * to expand the include file name, but since expand_env() is destructive
  788. +  * [it uses strtok()] the file name gets corrupted, and the "Content-Name"
  789. +  * header can contain a bogus value.  The easy fix would be a one-line
  790. +  * hack to Include_Part to use a temporary buffer.  This patch does not
  791. +  * implement the easy fix.  *Every* place expand_env() is used, its side
  792. +  * effects cause problems.  I think the right fix is to make expand_env()
  793. +  * non-destructive (i.e. have it duplicate the input to a temporary buffer
  794. +  * and work from there).  The attached patch modifies expand_env() in
  795. +  * that manner, and eliminates all of the `copy to a temporary buffer'
  796. +  * calls that precede it throughout elm.
  797. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  798. +  *
  799. +  * Revision 5.17  1993/06/10  02:55:34  syd
  800. +  * Write options to elmrc even if their values are empty strings.
  801. +  * Rationalize code that reads and writes weedouts and alternates.
  802. +  * From: chip%fin@myrddin.sybus.com
  803. +  *
  804.    * Revision 5.16  1993/05/16  20:59:14  syd
  805.    * fix not closing file
  806.    * From: Syd
  807. ***************
  808. *** 172,187 ****
  809.   **/
  810.   
  811.   #define SAVE_OPTS
  812. - #include <ctype.h>
  813.   #include "headers.h"
  814.   #include "save_opts.h"
  815.   #include "s_elm.h"
  816.   #include <errno.h>
  817.   
  818. - #ifdef BSD
  819. - #undef tolower
  820. - #endif
  821.   extern opts_menu *find_cfg_opts();
  822.   extern int errno;
  823.   
  824. --- 253,263 ----
  825. ***************
  826. *** 203,208 ****
  827. --- 279,299 ----
  828.   static int lineno = 0;
  829.   static int errors = 0;
  830.   
  831. + static void
  832. + do_expand_env(descr, dest, src, destlen)
  833. +     char    *descr, *dest, *src;
  834. +     unsigned    destlen;
  835. + {
  836. +     if (expand_env(dest, src, destlen) != 0) {
  837. +     printf(catgets(elm_msg_cat, ElmSet, ElmCannotInitErrorExpanding,
  838. +         "\r\nCannot initialize \"%s\" - error expanding \"%s\".\r\n"),
  839. +         descr, src);
  840. +     leave(0);
  841. +     }
  842. + }
  843.   read_rc_file()
  844.   {
  845.       /** this routine does all the actual work of reading in the
  846. ***************
  847. *** 237,270 ****
  848.   
  849.   
  850.       strcpy(raw_shell, ((cp = getenv("SHELL")) == NULL)? default_shell : cp);
  851. !     strcpy(temp, raw_shell);
  852. !     expand_env(shell, temp);
  853.   
  854.       strcpy(raw_pager, ((cp = getenv("PAGER")) == NULL)? default_pager : cp);
  855. !     strcpy(temp, raw_pager);
  856. !     expand_env(pager, temp);
  857. !     strcpy(raw_editor, ((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
  858.   
  859. !     strcpy(temp_dir, ((cp = getenv("TMPDIR")) == NULL)? default_temp:cp);
  860.       if (temp_dir[strlen (temp_dir)-1] != '/')
  861. !                 strcat(temp_dir, "/");
  862.   
  863.       strcpy(alternative_editor, raw_editor);
  864. !     strcpy(temp, raw_editor);
  865. !     expand_env(editor, temp);
  866.   
  867.       strcpy(raw_printout, default_printout);
  868. !     strcpy(temp, raw_printout);
  869. !     expand_env(printout, temp);
  870.   
  871.       sprintf(raw_folders, "~/%s", default_folders);
  872. !     strcpy(temp, raw_folders);
  873. !     expand_env(folders, temp);
  874.   
  875.       sprintf(raw_calendar_file, "~/%s", dflt_calendar_file);
  876. !     strcpy(temp, raw_calendar_file);
  877. !     expand_env(calendar_file, temp);
  878.   
  879.       strcpy(e_editor, emacs_editor);
  880.       strcpy(v_editor, default_editor);
  881. --- 328,356 ----
  882.   
  883.   
  884.       strcpy(raw_shell, ((cp = getenv("SHELL")) == NULL)? default_shell : cp);
  885. !     do_expand_env("shell", shell, raw_shell, sizeof(shell));
  886.   
  887.       strcpy(raw_pager, ((cp = getenv("PAGER")) == NULL)? default_pager : cp);
  888. !     do_expand_env("pager", pager, raw_pager, sizeof(pager));
  889.   
  890. !     strcpy(raw_temp_dir, (cp = getenv("TMPDIR")) ? cp : default_temp);
  891. !     do_expand_env("temp_dir", temp_dir, raw_temp_dir, sizeof(temp_dir));
  892.       if (temp_dir[strlen (temp_dir)-1] != '/')
  893. !         strcat(temp_dir, "/");
  894.   
  895. +     strcpy(raw_editor, ((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
  896.       strcpy(alternative_editor, raw_editor);
  897. !     do_expand_env("editor", editor, raw_editor, sizeof(editor));
  898.   
  899.       strcpy(raw_printout, default_printout);
  900. !     do_expand_env("printout", printout, raw_printout, sizeof(printout));
  901.   
  902.       sprintf(raw_folders, "~/%s", default_folders);
  903. !     do_expand_env("folders", folders, raw_folders, sizeof(folders));
  904.   
  905.       sprintf(raw_calendar_file, "~/%s", dflt_calendar_file);
  906. !     do_expand_env("calendar_file", calendar_file, raw_calendar_file,
  907. !         sizeof(calendar_file));
  908.   
  909.       strcpy(e_editor, emacs_editor);
  910.       strcpy(v_editor, default_editor);
  911. ***************
  912. *** 306,312 ****
  913.   
  914.         fflush(stdout);
  915.         ch=getchar();
  916. !       if (isupper(ch)) ch = tolower(ch);
  917.         if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
  918.           ch = *def_ans_no;
  919.   
  920. --- 392,398 ----
  921.   
  922.         fflush(stdout);
  923.         ch=getchar();
  924. !       ch = tolower(ch);
  925.         if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
  926.           ch = *def_ans_no;
  927.   
  928. ***************
  929. *** 332,339 ****
  930.   
  931.       /* try system-wide rc file */
  932.       file = fopen(system_rc_file, "r");
  933. !     do_rc(file, SYSTEM_RC);
  934. !     fclose(file);
  935.   
  936.       /* Look for the elmrc file */
  937.       sprintf(filename, "%s/%s", home, elmrcfile);
  938. --- 418,427 ----
  939.   
  940.       /* try system-wide rc file */
  941.       file = fopen(system_rc_file, "r");
  942. !     if ( file != NULL ) {
  943. !       do_rc(file, SYSTEM_RC);
  944. !       fclose(file);
  945. !     }
  946.   
  947.       /* Look for the elmrc file */
  948.       sprintf(filename, "%s/%s", home, elmrcfile);
  949. ***************
  950. *** 381,416 ****
  951.           }
  952.           *t = '\0';
  953.       }
  954. !     strcpy(buffer, raw_folders);
  955. !     expand_env(folders, buffer);
  956. !     strcpy(buffer, temp_dir);
  957. !     expand_env(temp_dir, buffer);
  958. !     if (temp_dir[strlen (temp_dir)-1] != '/')
  959. !         strcat(temp_dir, "/");
  960.   
  961. !     strcpy(buffer, raw_shell);
  962. !     expand_env(shell, buffer);
  963.   
  964. !     strcpy(buffer, raw_editor);
  965. !     expand_env(editor, buffer);
  966.   
  967. !     strcpy(buffer, raw_calendar_file);
  968. !     expand_env(calendar_file, buffer);
  969.   
  970. !     strcpy(buffer, raw_printout);
  971. !     expand_env(printout, buffer);
  972.   
  973. !     strcpy(buffer, raw_pager);
  974. !     expand_env(pager, buffer);
  975.       if (equal(pager, "builtin+") || equal(pager, "internal+"))
  976.           clear_pages++;
  977.   
  978. !     strcpy(buffer, raw_local_signature);
  979. !     expand_env(local_signature, buffer);
  980. !     strcpy(buffer, raw_remote_signature);
  981. !     expand_env(remote_signature, buffer);
  982.   
  983.       if (equal(local_signature, remote_signature) &&
  984.           (equal(shift_lower(local_signature), "on") ||
  985. --- 469,497 ----
  986.           }
  987.           *t = '\0';
  988.       }
  989. !     do_expand_env("folders", folders, raw_folders, sizeof(folders));
  990.   
  991. !     do_expand_env("temp_dir", temp_dir, raw_temp_dir, sizeof(temp_dir));
  992. !       if (temp_dir[strlen (temp_dir)-1] != '/')
  993. !           strcat(temp_dir, "/");
  994. !   
  995. !     do_expand_env("shell", shell, raw_shell, sizeof(shell));
  996.   
  997. !     do_expand_env("editor", editor, raw_editor, sizeof(editor));
  998.   
  999. !     do_expand_env("calendar_file", calendar_file, raw_calendar_file,
  1000. !         sizeof(calendar_file));
  1001.   
  1002. !     do_expand_env("printout", printout, raw_printout, sizeof(printout));
  1003.   
  1004. !     do_expand_env("pager", pager, raw_pager, sizeof(pager));
  1005.       if (equal(pager, "builtin+") || equal(pager, "internal+"))
  1006.           clear_pages++;
  1007.   
  1008. !     do_expand_env("local_signature", local_signature,
  1009. !         raw_local_signature, sizeof(local_signature));
  1010. !     do_expand_env("remote_signature", remote_signature,
  1011. !         raw_remote_signature, sizeof(remote_signature));
  1012.   
  1013.       if (equal(local_signature, remote_signature) &&
  1014.           (equal(shift_lower(local_signature), "on") ||
  1015. ***************
  1016. *** 477,483 ****
  1017.   
  1018.         fflush(stdout);
  1019.         ch=getchar();
  1020. !       if (isupper(ch)) ch = tolower(ch);
  1021.         if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
  1022.           ch = *def_ans_yes;
  1023.   
  1024. --- 558,564 ----
  1025.   
  1026.         fflush(stdout);
  1027.         ch=getchar();
  1028. !       ch = tolower(ch);
  1029.         if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
  1030.           ch = *def_ans_yes;
  1031.   
  1032. ***************
  1033. *** 510,517 ****
  1034.         strcpy(raw_recvdmail, default_recvdmail);
  1035.       }
  1036.   
  1037. !     strcpy(buffer, raw_recvdmail);
  1038. !     expand_env(recvd_mail, buffer);
  1039.   
  1040.       if(metachar(recvd_mail[0])) {
  1041.         strcpy(buffer, &recvd_mail[1]);
  1042. --- 591,598 ----
  1043.         strcpy(raw_recvdmail, default_recvdmail);
  1044.       }
  1045.   
  1046. !     do_expand_env("recvd_mail", recvd_mail, raw_recvdmail,
  1047. !         sizeof(recvd_mail));
  1048.   
  1049.       if(metachar(recvd_mail[0])) {
  1050.         strcpy(buffer, &recvd_mail[1]);
  1051. ***************
  1052. *** 523,530 ****
  1053.         sprintf(sent_mail, default_sentmail);
  1054.       }
  1055.   
  1056. !     strcpy(buffer, raw_sentmail);
  1057. !     expand_env(sent_mail, buffer);
  1058.   
  1059.       if(metachar(sent_mail[0])) {
  1060.         strcpy(buffer, &sent_mail[1]);
  1061. --- 604,610 ----
  1062.         sprintf(sent_mail, default_sentmail);
  1063.       }
  1064.   
  1065. !     do_expand_env("sent_mail", sent_mail, raw_sentmail, sizeof(sent_mail));
  1066.   
  1067.       if(metachar(sent_mail[0])) {
  1068.         strcpy(buffer, &sent_mail[1]);
  1069. ***************
  1070. *** 744,783 ****
  1071.   {
  1072.       /** This routine is called with a list of headers to weed out.   **/
  1073.   
  1074. !     char *strptr, *header;
  1075. !     register int i, len;
  1076.   
  1077.       strptr = string;
  1078.   
  1079. !     while ((header = strtok(strptr, "\t ,\"'")) != NULL) {
  1080. !       if (strlen(header) > 0) {
  1081. !         if (! istrcmp(header, "*end-of-user-headers*")) break;
  1082. !         if (! istrcmp(header, "*clear-weed-list*")) {
  1083. !           weedlist[0] = "*end-of-defaults*";
  1084. !           weedcount = 1;
  1085. !         }
  1086. !         if (weedcount > MAX_IN_WEEDLIST) {
  1087. !           printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedHeaders,
  1088. !         "Too many weed headers!  Leaving...\n\r"));
  1089. !           exit(1);
  1090. !         }
  1091. !         if ((weedlist[weedcount] = pmalloc(strlen(header) + 1)) == NULL) {
  1092. !           printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedPmalloc,
  1093. !         "Too many weed headers! Out of memory!  Leaving...\n\r"));
  1094. !           exit(1);
  1095. !         }
  1096.   
  1097. !         for (i=0, len = strlen(header); i< len; i++)
  1098. !           if (header[i] == '_') header[i] = ' ';
  1099.   
  1100. !             if(!matches_weedlist(header)) {
  1101. !           strcpy(weedlist[weedcount], header);
  1102. !           weedcount++;
  1103. !         }
  1104. ! /* since this used both for system defaults and user's */
  1105. !         if (equal(header, "*end-of-defaults*")) break;
  1106.         }
  1107. !       strptr = NULL;
  1108.       }
  1109.   }
  1110.   
  1111. --- 824,872 ----
  1112.   {
  1113.       /** This routine is called with a list of headers to weed out.   **/
  1114.   
  1115. !     char *strptr, *header, *p;
  1116. !     int finished;
  1117.   
  1118. +     finished = FALSE;
  1119.       strptr = string;
  1120. +     while (!finished && (header = strtokq(strptr, "\t ,", TRUE)) != NULL) {
  1121. +       strptr = NULL;
  1122.   
  1123. !       if (!*header)
  1124. !         continue;
  1125. !       for (p = header; *p; ++p) {
  1126. !         if (*p == '_')
  1127. !           *p = ' ';
  1128. !       }
  1129.   
  1130. !       if (! istrcmp(header, "*end-of-user-headers*"))
  1131. !         break;
  1132.   
  1133. !       if (! istrcmp(header, "*end-of-defaults*"))
  1134. !         finished = TRUE;
  1135. !       if (! istrcmp(header, "*clear-weed-list*")) {
  1136. !         while (weedcount)
  1137. !           free(weedlist[--weedcount]);
  1138. !         header = "*end-of-defaults*";
  1139.         }
  1140. !       if (matches_weedlist(header))
  1141. !         continue;
  1142. !       if (weedcount > MAX_IN_WEEDLIST) {
  1143. !         printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedHeaders,
  1144. !            "Too many weed headers!  Leaving...\n\r"));
  1145. !         exit(1);
  1146. !       }
  1147. !       if ((p = malloc(strlen(header) + 1)) == NULL) {
  1148. !         printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedPmalloc,
  1149. !            "Too many weed headers!  Out of memory!  Leaving...\n\r"));
  1150. !         exit(1);
  1151. !       }
  1152. !       strcpy(p, header);
  1153. !       weedlist[weedcount++] = p;
  1154.       }
  1155.   }
  1156.   
  1157. ***************
  1158. *** 840,846 ****
  1159.   
  1160.       for (weedcount = 0; default_list[weedcount] != (char *) 0;weedcount++){
  1161.         if ((weedlist[weedcount] = 
  1162. !           pmalloc(strlen(default_list[weedcount]) + 1)) == NULL) {
  1163.           printf(catgets(elm_msg_cat, ElmSet, ElmNoMemDefaultWeed,
  1164.           "\nNot enough memory for default weedlist. Leaving.\n"));
  1165.           leave(1);
  1166. --- 929,935 ----
  1167.   
  1168.       for (weedcount = 0; default_list[weedcount] != (char *) 0;weedcount++){
  1169.         if ((weedlist[weedcount] = 
  1170. !           malloc(strlen(default_list[weedcount]) + 1)) == NULL) {
  1171.           printf(catgets(elm_msg_cat, ElmSet, ElmNoMemDefaultWeed,
  1172.           "\nNot enough memory for default weedlist. Leaving.\n"));
  1173.           leave(1);
  1174. ***************
  1175. *** 883,892 ****
  1176.       for (i=0;buffer[i] != '\0' && ok_rc_char(buffer[i]); i++)
  1177.         if (buffer[i] == '_')
  1178.           word1[i] = '-';
  1179. -       else if (isupper(buffer[i]))
  1180. -         word1[i] = tolower(buffer[i]);
  1181.         else
  1182. !         word1[i] = buffer[i];
  1183.   
  1184.       word1[i++] = '\0';    /* that's the first word! */
  1185.   
  1186. --- 972,979 ----
  1187.       for (i=0;buffer[i] != '\0' && ok_rc_char(buffer[i]); i++)
  1188.         if (buffer[i] == '_')
  1189.           word1[i] = '-';
  1190.         else
  1191. !         word1[i] = tolower(buffer[i]);
  1192.   
  1193.       word1[i++] = '\0';    /* that's the first word! */
  1194.   
  1195. ***************
  1196. *** 913,967 ****
  1197.   
  1198.   }
  1199.   
  1200. ! expand_env(dest, buffer)
  1201. ! char *dest, *buffer;
  1202.   {
  1203. !     /** expand possible metacharacters in buffer and then copy
  1204. !         to dest... 
  1205.   
  1206. !         BEWARE!! Because strtok() is used on buffer, buffer may be changed.
  1207.   
  1208. !         This routine knows about "~" being the home directory,
  1209. !         and "$xxx" being an environment variable.
  1210. !     **/
  1211.   
  1212. !     char  *word, *string, next_word[SLEN];
  1213. !     
  1214. !     if (buffer[0] == '/') {
  1215. !       dest[0] = '/';
  1216. !       dest[1] = '\0';
  1217. ! /* Added for Apollos - handle //node */
  1218. !       if (buffer[1] == '/') {
  1219. !         dest[1] = '/';
  1220. !         dest[2] = '\0';
  1221. !       }
  1222. !     }
  1223. !     else
  1224. !       dest[0] = '\0';
  1225.   
  1226. !     string = (char *) buffer;
  1227.   
  1228. !     while ((word = strtok(string, "/")) != NULL) {
  1229. !       if (word[0] == '$') {
  1230. !         next_word[0] = '\0';
  1231. !         if (getenv((char *) (word + 1)) != NULL)
  1232. !         strcpy(next_word, getenv((char *) (word + 1)));
  1233. !         if (strlen(next_word) == 0)
  1234. !           leave(printf(catgets(elm_msg_cat, ElmSet, ElmCantExpandEnvVar,
  1235. !             "\n\rCan't expand environment variable '%s'.\n\r"),
  1236. !             word));
  1237. !       }
  1238. !       else if (word[0] == '~' && word[1] == '\0')
  1239. !         strcpy(next_word, home);
  1240. !       else
  1241. !         strcpy(next_word, word);
  1242.   
  1243. !       sprintf(dest, "%s%s%s", dest, 
  1244. !          (strlen(dest) > 0 && lastch(dest) != '/' ? "/":""),
  1245. !          next_word);
  1246.   
  1247. -       string = (char *) NULL;
  1248.       }
  1249.   }
  1250.   
  1251.   #define on_off(s)    (s == 1? "ON " : "OFF")
  1252. --- 1000,1098 ----
  1253.   
  1254.   }
  1255.   
  1256. ! /*
  1257. !  * expand_env() - Perform environment expansion on a pathname.  Also
  1258. !  * replaces "~" at the front of the path with the user's home directory.
  1259. !  * Environment expansion occurs at the path component boundaries, e.g.
  1260. !  * "/foo/$BAR/baz" is subject to expansion but "/foo/zzz$BAR/baz" is not.
  1261. !  * Returns 0 if expansion successful, -1 if an error occurs (result too
  1262. !  * long, cannot get home directory, or environment expansion failed).
  1263. !  */
  1264. ! expand_env(dest, src, destlen)
  1265. ! char *dest;        /* pointer to space to hold the result    */
  1266. ! char *src;        /* pointer to string to expand        */
  1267. ! unsigned destlen;    /* size of the destination buffer    */
  1268.   {
  1269. !     char envname_buf[SLEN], *envname_front, *expval;
  1270. !     int check_for_env, len, ret;
  1271.   
  1272. !     --destlen;        /* reserve space for trailing '\0' */
  1273. !     ret = 0;        /* assume success */
  1274.   
  1275. !     /*
  1276. !      * Replace "~" at front with user's home directory.
  1277. !      */
  1278. !     if (src[0] == '~' && (src[1] == '\0' || src[1] == '/')) {
  1279. !     if (home[0] == '\0') {
  1280. !         expval = "~";
  1281. !         ret = -1;
  1282. !     } else {
  1283. !         expval = home;
  1284. !     }
  1285. !     if ((len = strlen(expval)) > destlen)
  1286. !         len = destlen;
  1287. !     strfcpy(dest, expval, len+1);
  1288. !     dest += len;
  1289. !     destlen -= len;
  1290. !     ++src;
  1291. !     }
  1292. !     /*
  1293. !      * Copy through the rest, performing $NAME expansion where appropriate.
  1294. !      */
  1295. !     check_for_env = TRUE;
  1296. !     while (destlen > 0 && *src != '\0') {
  1297.   
  1298. !     /*
  1299. !      * Check for "$NAME" at the start of every path component.
  1300. !      */
  1301. !     if (check_for_env && *src == '$') {
  1302.   
  1303. !         /*
  1304. !          * Get the environment parameter name into "envname_buf"
  1305. !          * and advance "src" to the next path component.
  1306. !          */
  1307. !         envname_front = ++src;
  1308. !         if ((len = strcspn(src, "/")) == 0)
  1309. !         len = strlen(src);
  1310. !         src += len;
  1311. !         if (len > sizeof(envname_buf)-1)
  1312. !         len = sizeof(envname_buf)-1;
  1313. !         strfcpy(envname_buf, envname_front, len+1);
  1314. !         /*
  1315. !          * Copy over the environment expansion.  If the environment
  1316. !          * parameter is undefined then copy over unchanged and set
  1317. !          * a fail return status.
  1318. !          */
  1319. !         if ((expval = getenv(envname_buf)) == NULL) {
  1320. !         *dest++ = '$';
  1321. !         --destlen;
  1322. !         expval = envname_buf;
  1323. !         ret = -1;
  1324. !         }
  1325. !         if ((len = strlen(expval)) > destlen)
  1326. !         len = destlen;
  1327. !         strfcpy(dest, expval, len+1);
  1328. !         dest += len;
  1329. !         destlen -= len;
  1330. !         check_for_env = FALSE;
  1331.   
  1332. !     } else {
  1333.   
  1334. !         check_for_env = (*src == '/');
  1335. !         *dest++ = *src++;
  1336. !         --destlen;
  1337.   
  1338.       }
  1339. +     }
  1340. +     *dest = '\0';
  1341. +     if (destlen <= 0)
  1342. +     ret = -1;
  1343. +     return ret;
  1344.   }
  1345.   
  1346.   #define on_off(s)    (s == 1? "ON " : "OFF")
  1347. ***************
  1348. *** 1045,1051 ****
  1349.       register int i, j;
  1350.   
  1351.       for (i=0, j=0; word[i] != '\0'; i++)
  1352. !       mybuffer[j++] = isupper(word[i]) ? tolower(word[i]) : word[i];
  1353.       mybuffer[j] = '\0';
  1354.   
  1355.       return(  (strncmp(mybuffer, "on",   2) == 0) ||
  1356. --- 1176,1182 ----
  1357.       register int i, j;
  1358.   
  1359.       for (i=0, j=0; word[i] != '\0'; i++)
  1360. !       mybuffer[j++] = tolower(word[i]);
  1361.       mybuffer[j] = '\0';
  1362.   
  1363.       return(  (strncmp(mybuffer, "on",   2) == 0) ||
  1364.  
  1365. Index: src/remail.c
  1366. Prereq: 5.10
  1367. *** ../elm2.4/src/remail.c    Tue Apr 20 21:25:47 1993
  1368. --- src/remail.c    Sun Aug 22 23:26:55 1993
  1369. ***************
  1370. *** 1,8 ****
  1371.   
  1372. ! static char rcsid[] = "@(#)$Id: remail.c,v 5.10 1993/04/21 01:25:45 syd Exp $";
  1373.   
  1374.   /*******************************************************************************
  1375. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  1376.    *
  1377.    *            Copyright (c) 1988-1992 USENET Community Trust
  1378.    *            Copyright (c) 1986,1987 Dave Taylor
  1379. --- 1,8 ----
  1380.   
  1381. ! static char rcsid[] = "@(#)$Id: remail.c,v 5.12 1993/08/23 03:26:24 syd Exp $";
  1382.   
  1383.   /*******************************************************************************
  1384. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  1385.    *
  1386.    *            Copyright (c) 1988-1992 USENET Community Trust
  1387.    *            Copyright (c) 1986,1987 Dave Taylor
  1388. ***************
  1389. *** 14,19 ****
  1390. --- 14,29 ----
  1391.    *
  1392.    *******************************************************************************
  1393.    * $Log: remail.c,v $
  1394. +  * Revision 5.12  1993/08/23  03:26:24  syd
  1395. +  * Try setting group id separate from user id in chown to
  1396. +  * allow restricted systems to change group id of file
  1397. +  * From: Syd
  1398. +  *
  1399. +  * Revision 5.11  1993/08/10  18:53:31  syd
  1400. +  * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
  1401. +  * some reads of unitialized memory.
  1402. +  * From: vogt@isa.de
  1403. +  *
  1404.    * Revision 5.10  1993/04/21  01:25:45  syd
  1405.    * I'm using Elm 2.4.21 under Linux.  Linux has no Bourne shell.  Each
  1406.    * user installs her favorite shell as /bin/sh.  I use Bash 1.12.
  1407. ***************
  1408. *** 127,139 ****
  1409.               "Sorry - couldn't open file %s for writing (%s)."),
  1410.             error_description(err));
  1411.         set_error(buffer);
  1412.         return(1);
  1413.       }
  1414.   
  1415.       /** now let's copy the message into the newly opened
  1416.           buffer... **/
  1417.   
  1418. !     chown (filename, userid, groupid);
  1419.   
  1420.   #ifdef MMDF
  1421.       if (strcmp(submitmail, mailer) == 0)
  1422. --- 137,151 ----
  1423.               "Sorry - couldn't open file %s for writing (%s)."),
  1424.             error_description(err));
  1425.         set_error(buffer);
  1426. +       free(filename);
  1427.         return(1);
  1428.       }
  1429.   
  1430.       /** now let's copy the message into the newly opened
  1431.           buffer... **/
  1432.   
  1433. !     chown (filename, -1, groupid);
  1434. !     chown (filename, userid, -1);
  1435.   
  1436.   #ifdef MMDF
  1437.       if (strcmp(submitmail, mailer) == 0)
  1438. ***************
  1439. *** 158,163 ****
  1440. --- 170,176 ----
  1441.         set_error(catgets(elm_msg_cat, ElmSet, ElmBounceCancelled,
  1442.           "Bounce of message canceled."));
  1443.         (void) unlink(filename);
  1444. +       free(filename);
  1445.         return(1);
  1446.       }
  1447.   
  1448. ***************
  1449. *** 185,190 ****
  1450. --- 198,205 ----
  1451.       (void) system_call(buffer, 0);
  1452.       set_error(catgets(elm_msg_cat, ElmSet, ElmMailResent, "Mail resent."));
  1453.   
  1454. +         free(filename);
  1455.       return(1);
  1456.   }
  1457.   #ifdef MMDF
  1458.  
  1459. Index: src/reply.c
  1460. Prereq: 5.12
  1461. *** ../elm2.4/src/reply.c    Sun Apr 11 23:02:06 1993
  1462. --- src/reply.c    Tue Aug  3 15:29:18 1993
  1463. ***************
  1464. *** 1,8 ****
  1465.   
  1466. ! static char rcsid[] = "@(#)$Id: reply.c,v 5.12 1993/04/12 03:02:05 syd Exp $";
  1467.   
  1468.   /*******************************************************************************
  1469. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  1470.    *
  1471.    *            Copyright (c) 1988-1992 USENET Community Trust
  1472.    *            Copyright (c) 1986,1987 Dave Taylor
  1473. --- 1,8 ----
  1474.   
  1475. ! static char rcsid[] = "@(#)$Id: reply.c,v 5.15 1993/08/03 19:28:39 syd Exp $";
  1476.   
  1477.   /*******************************************************************************
  1478. !  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
  1479.    *
  1480.    *            Copyright (c) 1988-1992 USENET Community Trust
  1481.    *            Copyright (c) 1986,1987 Dave Taylor
  1482. ***************
  1483. *** 14,19 ****
  1484. --- 14,56 ----
  1485.    *
  1486.    *******************************************************************************
  1487.    * $Log: reply.c,v $
  1488. +  * Revision 5.15  1993/08/03  19:28:39  syd
  1489. +  * Elm tries to replace the system toupper() and tolower() on current
  1490. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1491. +  * collide during linking with routines in isctype.o.  This patch adds
  1492. +  * a Configure test to determine whether replacements are really needed
  1493. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1494. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1495. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1496. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1497. +  * were dropped.
  1498. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1499. +  *
  1500. +  * Revision 5.14  1993/07/20  02:05:17  syd
  1501. +  * A long-standing bug of handling replies to VMS systems.
  1502. +  * Original "From: " -line is of format:
  1503. +  *     From: "NAME \"Real Name\"" <USERNAME@vms-system>
  1504. +  * (PMDF mailer)
  1505. +  *     Anyway,  parse_arpa_who()  strips quotes too cleanly
  1506. +  * resulting data:
  1507. +  *     NAME \"Real Name\
  1508. +  * which, when put into parenthesis, becomes:
  1509. +  *     (NAME \"Real Name\)
  1510. +  * which in its turn lacks closing `)'
  1511. +  * Patch of  lib/parsarpwho.c  fixes that.
  1512. +  * strtokq() started one position too late to search for next double-quote (") char.
  1513. +  * Another one-off (chops off trailing comment character, quote or not..)  in   src/reply.c
  1514. +  * From:    Matti Aarnio <mea@utu.fi>
  1515. +  *
  1516. +  * Revision 5.13  1993/06/10  03:02:46  syd
  1517. +  * break_down_tolist() tried to blindly split address lists at "," which
  1518. +  * caused bogus results with addreses that had a comma inside a comment
  1519. +  * or quoted text, such as "user@domain (Last, First)".  This patch steps
  1520. +  * through the address in quanta of RFC-822 tokens when searching for a
  1521. +  * delimiting comma.  It also adds "rfc822_toklen()" to the library to
  1522. +  * get that length.
  1523. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1524. +  *
  1525.    * Revision 5.12  1993/04/12  03:02:05  syd
  1526.    * If a To: or Cc: line is split in a comment, that is between ( and ),
  1527.    * get_and_expand_everyone won't parse that correctly.
  1528. ***************
  1529. *** 79,89 ****
  1530.   #include "headers.h"
  1531.   #include "s_elm.h"
  1532.   #include <errno.h>
  1533. - #include <ctype.h>
  1534. - #ifdef BSD
  1535. - #undef        tolower
  1536. - #endif
  1537.   
  1538.   /** Note that this routine generates automatic header information
  1539.       for the subject and (obviously) to lines, but that these can
  1540. --- 116,121 ----
  1541. ***************
  1542. *** 609,619 ****
  1543.           buffer[loc++] = buf[(*iindex)++]; /* Copy final " */
  1544.       }
  1545.   
  1546. !     while (buf[*iindex] != ',' && buf[*iindex] != '\0')
  1547. !       buffer[loc++] = buf[(*iindex)++];
  1548. !     (*iindex)++;
  1549.       buffer[loc] = '\0';
  1550.   
  1551.       while (whitespace(buffer[loc]))     /* remove trailing whitespace */
  1552. --- 641,664 ----
  1553.           buffer[loc++] = buf[(*iindex)++]; /* Copy final " */
  1554.       }
  1555.   
  1556. !     /*
  1557. !      * Previously, we just went looking for a "," to seperate the
  1558. !      * addresses.  This meant that addresses like:
  1559. !      *
  1560. !      *    joe@acme.com (LastName, Firstname)
  1561. !      *
  1562. !      * got split right down the middle.  The following was changed
  1563. !      * to step through the address in quanta of RFC-822 tokens.
  1564. !      * That fixes the bug, but this routine is still incurably ugly.
  1565. !      */
  1566. !     i = *iindex;
  1567. !     while (buf[i] != ',' && buf[i] != '\0') {
  1568. !         len = rfc822_toklen(buf+i);
  1569. !         strncpy(buffer+loc, buf+i, len);
  1570. !         loc += len;
  1571. !         i += len;
  1572. !     }
  1573. !     *iindex = i + (buf[i] != '\0' ? 1 : 0);
  1574.       buffer[loc] = '\0';
  1575.   
  1576.       while (whitespace(buffer[loc]))     /* remove trailing whitespace */
  1577. ***************
  1578. *** 649,659 ****
  1579.         for (loc = 0, len = strlen(buffer);buffer[loc] != '<' && loc < len; loc++)
  1580.           /* get to the opening comment character... */ ;
  1581.         while (whitespace(buffer[loc])) loc--;    /* back up */
  1582.   
  1583.         /** get the comment field... **/
  1584.   
  1585.         comment[0] = '(';
  1586. !       for (i=1; i < loc; i++)
  1587.           comment[i] = buffer[i-1];
  1588.         comment[i++] = ')';
  1589.         comment[i] = '\0';
  1590. --- 694,705 ----
  1591.         for (loc = 0, len = strlen(buffer);buffer[loc] != '<' && loc < len; loc++)
  1592.           /* get to the opening comment character... */ ;
  1593.         while (whitespace(buffer[loc])) loc--;    /* back up */
  1594. +       if (loc >= 0 && !whitespace(buffer[loc])) loc++; /* And fwd again! */
  1595.   
  1596.         /** get the comment field... **/
  1597.   
  1598.         comment[0] = '(';
  1599. !       for (i=1; i <= loc; i++)
  1600.           comment[i] = buffer[i-1];
  1601.         comment[i++] = ')';
  1602.         comment[i] = '\0';
  1603.  
  1604. Index: src/save_opts.c
  1605. Prereq: 5.2
  1606. *** ../elm2.4/src/save_opts.c    Sun Apr 11 23:10:54 1993
  1607. --- src/save_opts.c    Sun Aug 22 23:26:56 1993
  1608. ***************
  1609. *** 1,8 ****
  1610.   
  1611. ! static char rcsid[] = "@(#)$Id: save_opts.c,v 5.2 1993/04/12 03:10:54 syd Exp $";
  1612.   
  1613.   /*******************************************************************************
  1614. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1615.    *
  1616.    *            Copyright (c) 1988-1992 USENET Community Trust
  1617.    *            Copyright (c) 1986,1987 Dave Taylor
  1618. --- 1,8 ----
  1619.   
  1620. ! static char rcsid[] = "@(#)$Id: save_opts.c,v 5.6 1993/08/23 03:26:24 syd Exp $";
  1621.   
  1622.   /*******************************************************************************
  1623. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  1624.    *
  1625.    *            Copyright (c) 1988-1992 USENET Community Trust
  1626.    *            Copyright (c) 1986,1987 Dave Taylor
  1627. ***************
  1628. *** 14,19 ****
  1629. --- 14,37 ----
  1630.    *
  1631.    *******************************************************************************
  1632.    * $Log: save_opts.c,v $
  1633. +  * Revision 5.6  1993/08/23  03:26:24  syd
  1634. +  * Try setting group id separate from user id in chown to
  1635. +  * allow restricted systems to change group id of file
  1636. +  * From: Syd
  1637. +  *
  1638. +  * Revision 5.5  1993/08/10  18:54:45  syd
  1639. +  * Elm was failing to write an empty "alternatives" list to elmrc.
  1640. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1641. +  *
  1642. +  * Revision 5.4  1993/08/03  19:03:52  syd
  1643. +  * "*clear-weed-list*" in elmrc was wiped out when one saved the options in elm.
  1644. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  1645. +  *
  1646. +  * Revision 5.3  1993/06/10  02:55:34  syd
  1647. +  * Write options to elmrc even if their values are empty strings.
  1648. +  * Rationalize code that reads and writes weedouts and alternates.
  1649. +  * From: chip%fin@myrddin.sybus.com
  1650. +  *
  1651.    * Revision 5.2  1993/04/12  03:10:54  syd
  1652.    * The onoff macro assumes a boolean option only has values 1 or 0.
  1653.    * This is not true for forms option (may be 2 == MAYBE).
  1654. ***************
  1655. *** 86,92 ****
  1656.         if (rename(newfname, oldfname) < 0)
  1657.           dprint(2, (debugfile, "Unable to rename %s to %s\n", 
  1658.              newfname, oldfname));
  1659. !       (void) chown(oldfname, userid, groupid);
  1660.   
  1661.       }
  1662.   
  1663. --- 104,111 ----
  1664.         if (rename(newfname, oldfname) < 0)
  1665.           dprint(2, (debugfile, "Unable to rename %s to %s\n", 
  1666.              newfname, oldfname));
  1667. !       (void) chown(oldfname, -1, groupid);
  1668. !       (void) chown(oldfname, userid, -1);
  1669.   
  1670.       }
  1671.   
  1672. ***************
  1673. *** 241,247 ****
  1674.           continue;
  1675.   
  1676.           local_value = save_info[x].flags & FL_LOCAL;
  1677. !         s="";
  1678.           switch(save_info[x].flags & DT_MASK) {
  1679.           case DT_MLT:
  1680.           case DT_SYN:
  1681. --- 260,266 ----
  1682.           continue;
  1683.   
  1684.           local_value = save_info[x].flags & FL_LOCAL;
  1685. !         s = NULL;
  1686.           switch(save_info[x].flags & DT_MASK) {
  1687.           case DT_MLT:
  1688.           case DT_SYN:
  1689. ***************
  1690. *** 260,292 ****
  1691.               break;
  1692.   
  1693.           case DT_WEE:
  1694. !             { int len = 0 ,i;
  1695.   
  1696.               add_comment(x, newelmrc);
  1697.               if (!local_value)
  1698.                   fprintf(newelmrc, "### ");
  1699. !             fprintf(newelmrc, "%s = ", save_info[x].name);
  1700. !             len = strlen(save_info[x].name) + 4;
  1701.   
  1702. !             for (i = 0; i < weedcount && strcmp(weedlist[i], "*end-of-defaults*") !=0; i++)
  1703. !                 /* intentional null loop body */;
  1704. !             while (i < weedcount && equal(weedlist[i], "*end-of-defaults*"))
  1705.                   i++;
  1706.   
  1707. !             while (i < weedcount) {
  1708. !                 if (strlen(weedlist[i]) + len > 78) {
  1709.                   if (local_value)
  1710.                       fprintf(newelmrc, "\n\t");
  1711.                   else
  1712.                       fprintf(newelmrc, "\n###\t");
  1713.                   len = 8;
  1714.                   }
  1715. !                 fprintf(newelmrc, "\"%s\" ", weedlist[i]);
  1716. !                 len += strlen(weedlist[i]) + 4;
  1717. !                 ++i;
  1718.               }
  1719. !             fprintf(newelmrc, "\t\"*end-of-user-headers*\"\n");
  1720.               }
  1721.               break;
  1722.   
  1723. --- 279,330 ----
  1724.               break;
  1725.   
  1726.           case DT_WEE:
  1727. !             {    int len, i;
  1728. !             char *w;
  1729.   
  1730.               add_comment(x, newelmrc);
  1731.               if (!local_value)
  1732.                   fprintf(newelmrc, "### ");
  1733. !             fprintf(newelmrc, "%s =", save_info[x].name);
  1734. !             len = strlen(save_info[x].name) + 6;
  1735.   
  1736. !             i = 0;
  1737. !             while (i < weedcount
  1738. !                    && istrcmp(weedlist[i], "*end-of-defaults*"))
  1739. !                 i++;
  1740. !             while (i < weedcount
  1741. !                    && !istrcmp(weedlist[i], "*end-of-defaults*"))
  1742.                   i++;
  1743. +             if (i == 1) {
  1744. +                 /* end-of-defaults in the first position means
  1745. +                 ** that there are no defaults, i.e.
  1746. +                 ** a clear-weed-list has been done.
  1747. +                 */
  1748. +                 fprintf(newelmrc, " \"*clear-weed-list*\"");
  1749. +                 len += 20;
  1750. +             }
  1751.   
  1752. !             while (i <= weedcount) {
  1753. !                 char *w;
  1754. !                 w = (i < weedcount) ? weedlist[i]
  1755. !                 : "*end-of-user-headers*";
  1756. !                 if (strlen(w) + len > 72) {
  1757.                   if (local_value)
  1758.                       fprintf(newelmrc, "\n\t");
  1759.                   else
  1760.                       fprintf(newelmrc, "\n###\t");
  1761.                   len = 8;
  1762.                   }
  1763. !                 else {
  1764. !                 fprintf(newelmrc, " ");
  1765. !                 ++len;
  1766. !                 }
  1767. !                 fprintf(newelmrc, "\"%s\"", w);
  1768. !                 len += strlen(w) + 3;
  1769. !                 i++;
  1770.               }
  1771. !             fprintf(newelmrc, "\n");
  1772.               }
  1773.               break;
  1774.   
  1775. ***************
  1776. *** 295,331 ****
  1777.               int len=0;
  1778.   
  1779.               alts = *SAVE_INFO_ALT(x);
  1780. -             if (!alts) break;
  1781.               add_comment(x, newelmrc);
  1782.               if (!local_value)
  1783.                   fprintf(newelmrc, "### ");
  1784. !             fprintf(newelmrc, "%s = ", save_info[x].name);
  1785. !             len = strlen(save_info[x].name) + 4;
  1786.               for ( ;alts; alts = alts->next) {
  1787. !                 if (strlen(alts->address) + len > 78) {
  1788.                   if (local_value)
  1789.                       fprintf(newelmrc, "\n\t");
  1790.                   else
  1791.                       fprintf(newelmrc, "\n###\t");
  1792.                   len = 8;
  1793.                   }
  1794. !             fprintf(newelmrc, "%s ", alts->address);
  1795. !             len += strlen(alts->address) + 2;
  1796.               }
  1797.               }
  1798. -             fprintf(newelmrc,"\n");
  1799.               break;
  1800.           }
  1801.   
  1802. !         if (*s) {
  1803.           add_comment(x, newelmrc);
  1804. !         if (local_value)
  1805. !             fprintf(newelmrc, "%s = %s\n", save_info[x].name, s);
  1806. !         else
  1807. !             fprintf(newelmrc, "### %s = %s\n", save_info[x].name, s);
  1808. !         }
  1809.           }
  1810.   
  1811.       fclose(newelmrc);
  1812.       if ( elminfo_fd != NULL ) {
  1813. --- 333,370 ----
  1814.               int len=0;
  1815.   
  1816.               alts = *SAVE_INFO_ALT(x);
  1817.               add_comment(x, newelmrc);
  1818.               if (!local_value)
  1819.                   fprintf(newelmrc, "### ");
  1820. !             fprintf(newelmrc, "%s =", save_info[x].name);
  1821. !             len = strlen(save_info[x].name) + 6;
  1822.               for ( ;alts; alts = alts->next) {
  1823. !                 if (strlen(alts->address) + len > 72) {
  1824.                   if (local_value)
  1825.                       fprintf(newelmrc, "\n\t");
  1826.                   else
  1827.                       fprintf(newelmrc, "\n###\t");
  1828.                   len = 8;
  1829.                   }
  1830. !                 else {
  1831. !                 fprintf(newelmrc, " ");
  1832. !                 ++len;
  1833. !                 }
  1834. !                 fprintf(newelmrc, "%s", alts->address);
  1835. !                 len += strlen(alts->address);
  1836.               }
  1837. +             fprintf(newelmrc,"\n");
  1838.               }
  1839.               break;
  1840.           }
  1841.   
  1842. !         if (s) {
  1843.           add_comment(x, newelmrc);
  1844. !         if (!local_value)
  1845. !             fprintf(newelmrc, "### ");
  1846. !         fprintf(newelmrc, "%s = %s\n", save_info[x].name, s);
  1847.           }
  1848. +     }
  1849.   
  1850.       fclose(newelmrc);
  1851.       if ( elminfo_fd != NULL ) {
  1852.  
  1853. Index: src/showmsg.c
  1854. Prereq: 5.13
  1855. *** ../elm2.4/src/showmsg.c    Sat May  8 16:25:51 1993
  1856. --- src/showmsg.c    Sun Aug 22 22:46:09 1993
  1857. ***************
  1858. *** 1,8 ****
  1859.   
  1860. ! static char rcsid[] = "@(#)$Id: showmsg.c,v 5.13 1993/05/08 20:25:33 syd Exp $";
  1861.   
  1862.   /*******************************************************************************
  1863. !  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
  1864.    *
  1865.    *             Copyright (c) 1988-1992 USENET Community Trust
  1866.    *             Copyright (c) 1986,1987 Dave Taylor
  1867. --- 1,8 ----
  1868.   
  1869. ! static char rcsid[] = "@(#)$Id: showmsg.c,v 5.15 1993/08/23 02:46:07 syd Exp $";
  1870.   
  1871.   /*******************************************************************************
  1872. !  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
  1873.    *
  1874.    *             Copyright (c) 1988-1992 USENET Community Trust
  1875.    *             Copyright (c) 1986,1987 Dave Taylor
  1876. ***************
  1877. *** 14,19 ****
  1878. --- 14,35 ----
  1879.    *
  1880.    *******************************************************************************
  1881.    * $Log: showmsg.c,v $
  1882. +  * Revision 5.15  1993/08/23  02:46:07  syd
  1883. +  * Don't declare _exit() if <unistd.h> already did it.
  1884. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  1885. +  *
  1886. +  * Revision 5.14  1993/08/03  19:28:39  syd
  1887. +  * Elm tries to replace the system toupper() and tolower() on current
  1888. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1889. +  * collide during linking with routines in isctype.o.  This patch adds
  1890. +  * a Configure test to determine whether replacements are really needed
  1891. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1892. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1893. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1894. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1895. +  * were dropped.
  1896. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1897. +  *
  1898.    * Revision 5.13  1993/05/08  20:25:33  syd
  1899.    * Add sleepmsg to control transient message delays
  1900.    * From: Syd
  1901. ***************
  1902. *** 85,102 ****
  1903.   
  1904.   #include "headers.h"
  1905.   #include "s_elm.h"
  1906. - #include <ctype.h>
  1907.   #include <errno.h>
  1908.   
  1909.   #ifdef BSD
  1910.   # include <sys/wait.h>
  1911. ! # undef       tolower
  1912.   #endif
  1913.   
  1914.   extern int errno;
  1915.   
  1916.   extern char *elm_date_str(), *error_description();
  1917. - void   _exit();
  1918.   
  1919.   int    memory_lock = FALSE;    /* is it available?? */
  1920.   int    pipe_abort  = FALSE;    /* did we receive a SIGNAL(SIGPIPE)? */
  1921. --- 101,119 ----
  1922.   
  1923.   #include "headers.h"
  1924.   #include "s_elm.h"
  1925.   #include <errno.h>
  1926.   
  1927.   #ifdef BSD
  1928.   # include <sys/wait.h>
  1929. ! #endif
  1930. ! #ifndef I_UNISTD
  1931. ! void _exit();
  1932.   #endif
  1933.   
  1934.   extern int errno;
  1935.   
  1936.   extern char *elm_date_str(), *error_description();
  1937.   
  1938.   int    memory_lock = FALSE;    /* is it available?? */
  1939.   int    pipe_abort  = FALSE;    /* did we receive a SIGNAL(SIGPIPE)? */
  1940.  
  1941. Index: src/signals.c
  1942. Prereq: 5.8
  1943. *** ../elm2.4/src/signals.c    Sun Apr 11 23:04:59 1993
  1944. --- src/signals.c    Tue Aug  3 15:10:51 1993
  1945. ***************
  1946. *** 1,8 ****
  1947.   
  1948. ! static char rcsid[] = "@(#)$Id: signals.c,v 5.8 1993/04/12 03:04:58 syd Exp $";
  1949.   
  1950.   /*******************************************************************************
  1951. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  1952.    *
  1953.    *            Copyright (c) 1988-1992 USENET Community Trust
  1954.    *            Copyright (c) 1986,1987 Dave Taylor
  1955. --- 1,8 ----
  1956.   
  1957. ! static char rcsid[] = "@(#)$Id: signals.c,v 5.9 1993/08/03 19:10:50 syd Exp $";
  1958.   
  1959.   /*******************************************************************************
  1960. !  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
  1961.    *
  1962.    *            Copyright (c) 1988-1992 USENET Community Trust
  1963.    *            Copyright (c) 1986,1987 Dave Taylor
  1964. ***************
  1965. *** 14,19 ****
  1966. --- 14,26 ----
  1967.    *
  1968.    *******************************************************************************
  1969.    * $Log: signals.c,v $
  1970. +  * Revision 5.9  1993/08/03  19:10:50  syd
  1971. +  * Patch for Elm 2.4 PL22 to correct handling of SIGWINCH signals on
  1972. +  * DecStations with Ultrix 4.2.
  1973. +  * The problem was that elm running in an xterm exits silently when the
  1974. +  * window is resize. This was caused by incorrect signal handling for BSD.
  1975. +  * From: vogt@isa.de
  1976. +  *
  1977.    * Revision 5.8  1993/04/12  03:04:58  syd
  1978.    * The USR2 signal lost messages on some OS:es and did an unnecessary resync
  1979.    * on others.
  1980. ***************
  1981. *** 201,210 ****
  1982.   SIGHAND_TYPE
  1983.   winch_signal(sig)
  1984.   {
  1985.   #ifndef    BSD
  1986.       signal(SIGWINCH, winch_signal);
  1987.   #endif
  1988. -     resize_screen = 1;
  1989.   }
  1990.   #endif
  1991.   
  1992. --- 208,220 ----
  1993.   SIGHAND_TYPE
  1994.   winch_signal(sig)
  1995.   {
  1996. +     resize_screen = 1;
  1997.   #ifndef    BSD
  1998.       signal(SIGWINCH, winch_signal);
  1999. + #else
  2000. +     if (InGetPrompt)
  2001. +       longjmp(GetPromptBuf, 1);
  2002.   #endif
  2003.   }
  2004.   #endif
  2005.   
  2006.  
  2007. Index: src/string2.c
  2008. Prereq: 5.1
  2009. *** ../elm2.4/src/string2.c    Sat Oct  3 18:59:20 1992
  2010. --- src/string2.c    Tue Aug  3 15:29:21 1993
  2011. ***************
  2012. *** 1,8 ****
  2013.   
  2014. ! static char rcsid[] = "@(#)$Id: string2.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  2015.   
  2016.   /*******************************************************************************
  2017. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  2018.    *
  2019.    *             Copyright (c) 1988-1992 USENET Community Trust
  2020.    *             Copyright (c) 1986,1987 Dave Taylor
  2021. --- 1,8 ----
  2022.   
  2023. ! static char rcsid[] = "@(#)$Id: string2.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  2024.   
  2025.   /*******************************************************************************
  2026. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  2027.    *
  2028.    *             Copyright (c) 1988-1992 USENET Community Trust
  2029.    *             Copyright (c) 1986,1987 Dave Taylor
  2030. ***************
  2031. *** 14,19 ****
  2032. --- 14,31 ----
  2033.    *
  2034.    *******************************************************************************
  2035.    * $Log: string2.c,v $
  2036. +  * Revision 5.2  1993/08/03  19:28:39  syd
  2037. +  * Elm tries to replace the system toupper() and tolower() on current
  2038. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2039. +  * collide during linking with routines in isctype.o.  This patch adds
  2040. +  * a Configure test to determine whether replacements are really needed
  2041. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2042. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2043. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2044. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2045. +  * were dropped.
  2046. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2047. +  *
  2048.    * Revision 5.1  1992/10/03  22:58:40  syd
  2049.    * Initial checkin as of 2.4 Release at PL0
  2050.    *
  2051. ***************
  2052. *** 26,37 ****
  2053.   **/
  2054.   
  2055.   #include "headers.h"
  2056. - #include <ctype.h>
  2057. - #ifdef BSD
  2058. - #undef tolower
  2059. - #undef toupper
  2060. - #endif
  2061.   
  2062.   
  2063.   int
  2064. --- 38,43 ----
  2065.  
  2066. Index: src/strings.c
  2067. Prereq: 5.6
  2068. *** ../elm2.4/src/strings.c    Tue Jan 19 22:02:41 1993
  2069. --- src/strings.c    Tue Aug  3 15:29:23 1993
  2070. ***************
  2071. *** 1,8 ****
  2072.   
  2073. ! static char rcsid[] = "@(#)$Id: strings.c,v 5.6 1993/01/20 03:02:19 syd Exp $";
  2074.   
  2075.   /*******************************************************************************
  2076. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  2077.    *
  2078.    *             Copyright (c) 1986, 1987 Dave Taylor
  2079.    *             Copyright (c) 1988, 1989, 1990, 1991 USENET Community Trust
  2080. --- 1,8 ----
  2081.   
  2082. ! static char rcsid[] = "@(#)$Id: strings.c,v 5.8 1993/08/03 19:28:39 syd Exp $";
  2083.   
  2084.   /*******************************************************************************
  2085. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  2086.    *
  2087.    *             Copyright (c) 1986, 1987 Dave Taylor
  2088.    *             Copyright (c) 1988, 1989, 1990, 1991 USENET Community Trust
  2089. ***************
  2090. *** 14,19 ****
  2091. --- 14,35 ----
  2092.    *
  2093.    *******************************************************************************
  2094.    * $Log: strings.c,v $
  2095. +  * Revision 5.8  1993/08/03  19:28:39  syd
  2096. +  * Elm tries to replace the system toupper() and tolower() on current
  2097. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2098. +  * collide during linking with routines in isctype.o.  This patch adds
  2099. +  * a Configure test to determine whether replacements are really needed
  2100. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2101. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2102. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2103. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2104. +  * were dropped.
  2105. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2106. +  *
  2107. +  * Revision 5.7  1993/07/20  02:26:58  syd
  2108. +  * Fix copy_sans_escape handling of tabs
  2109. +  * From: Syd via code from G A Smant
  2110. +  *
  2111.    * Revision 5.6  1993/01/20  03:02:19  syd
  2112.    * Move string declarations to defs.h
  2113.    * From: Syd
  2114. ***************
  2115. *** 55,67 ****
  2116.   
  2117.   #include "headers.h"
  2118.   #include "s_elm.h"
  2119. - #include <ctype.h>
  2120.   
  2121. - #ifdef BSD
  2122. - #undef tolower
  2123. - #undef toupper
  2124. - #endif
  2125.   /** forward declarations **/
  2126.   
  2127.   char *format_long(), *strip_commas(), *tail_of_string(),
  2128. --- 71,77 ----
  2129. ***************
  2130. *** 81,89 ****
  2131.   
  2132.       while (i < len && j < len && source[i] != '\0') {
  2133.         if (source[i] == '\t') {
  2134. !          n = next_tab(j) - j;
  2135.            while (n-- && j < len)
  2136.            dest[j++] = ' ';
  2137.         } else if (iscntrl(source[i])) {
  2138.            dest[j++] = '^';
  2139.            if (j < len)
  2140. --- 91,100 ----
  2141.   
  2142.       while (i < len && j < len && source[i] != '\0') {
  2143.         if (source[i] == '\t') {
  2144. !          n = (next_tab(j) - j) - 1;
  2145.            while (n-- && j < len)
  2146.            dest[j++] = ' ';
  2147. +          i++;
  2148.         } else if (iscntrl(source[i])) {
  2149.            dest[j++] = '^';
  2150.            if (j < len)
  2151. ***************
  2152. *** 200,209 ****
  2153.           break;
  2154.   
  2155.         while (--len >= 0) {
  2156. !         if (islower(*buffer))
  2157. !           *first = *buffer;
  2158. !         else
  2159. !           *first = tolower(*buffer);
  2160.           buffer++;
  2161.           first++;
  2162.         }
  2163. --- 211,217 ----
  2164.           break;
  2165.   
  2166.         while (--len >= 0) {
  2167. !         *first = tolower(*buffer);
  2168.           buffer++;
  2169.           first++;
  2170.         }
  2171. ***************
  2172. *** 219,228 ****
  2173.    */
  2174.   
  2175.       for (; *buffer; buffer++, rest++)
  2176. !       if (islower(*buffer))
  2177. !         *rest = *buffer;
  2178. !       else
  2179. !         *rest = tolower(*buffer);
  2180.   
  2181.       *rest = '\0';
  2182.   
  2183. --- 227,233 ----
  2184.    */
  2185.   
  2186.       for (; *buffer; buffer++, rest++)
  2187. !       *rest = tolower(*buffer);
  2188.   
  2189.       *rest = '\0';
  2190.   
  2191.  
  2192. Index: src/syscall.c
  2193. Prereq: 5.7
  2194. *** ../elm2.4/src/syscall.c    Sat May  8 16:25:52 1993
  2195. --- src/syscall.c    Sun Aug 22 22:46:10 1993
  2196. ***************
  2197. *** 1,8 ****
  2198.   
  2199. ! static char rcsid[] = "@(#)$Id: syscall.c,v 5.7 1993/01/20 03:48:08 syd Exp $";
  2200.   
  2201.   /*******************************************************************************
  2202. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  2203.    *
  2204.    *            Copyright (c) 1988-1992 USENET Community Trust
  2205.    *            Copyright (c) 1986,1987 Dave Taylor
  2206. --- 1,8 ----
  2207.   
  2208. ! static char rcsid[] = "@(#)$Id: syscall.c,v 5.8 1993/08/23 02:46:07 syd Exp $";
  2209.   
  2210.   /*******************************************************************************
  2211. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  2212.    *
  2213.    *            Copyright (c) 1988-1992 USENET Community Trust
  2214.    *            Copyright (c) 1986,1987 Dave Taylor
  2215. ***************
  2216. *** 14,23 ****
  2217.    *
  2218.    *******************************************************************************
  2219.    * $Log: syscall.c,v $
  2220. !  * Revision 5.7  1993/01/20  03:48:08  syd
  2221. !  * Fix not to use vfork if SY_ENV_SHELL is set, as this causes the
  2222. !  * parent environment to be modified.
  2223. !  * From: Syd
  2224.    *
  2225.    * Revision 5.7  1993/01/20  03:48:08  syd
  2226.    * Fix not to use vfork if SY_ENV_SHELL is set, as this causes the
  2227. --- 14,22 ----
  2228.    *
  2229.    *******************************************************************************
  2230.    * $Log: syscall.c,v $
  2231. !  * Revision 5.8  1993/08/23  02:46:07  syd
  2232. !  * Don't declare _exit() if <unistd.h> already did it.
  2233. !  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  2234.    *
  2235.    * Revision 5.7  1993/01/20  03:48:08  syd
  2236.    * Fix not to use vfork if SY_ENV_SHELL is set, as this causes the
  2237. ***************
  2238. *** 69,76 ****
  2239.   #  include <sys/wait.h>
  2240.   #endif
  2241.   
  2242.   char *argv_zero();    
  2243. - void  _exit();
  2244.   
  2245.   #ifdef ALLOW_SUBSHELL
  2246.   
  2247. --- 68,78 ----
  2248.   #  include <sys/wait.h>
  2249.   #endif
  2250.   
  2251. + #ifndef I_UNISTD
  2252. + void _exit();
  2253. + #endif
  2254.   char *argv_zero();    
  2255.   
  2256.   #ifdef ALLOW_SUBSHELL
  2257.   
  2258.  
  2259. Index: src/utils.c
  2260. Prereq: 5.10
  2261. *** ../elm2.4/src/utils.c    Sun Apr 11 23:11:50 1993
  2262. --- src/utils.c    Sun Aug 22 23:26:56 1993
  2263. ***************
  2264. *** 1,8 ****
  2265.   
  2266. ! static char rcsid[] = "@(#)$Id: utils.c,v 5.10 1993/04/12 03:11:50 syd Exp $";
  2267.   
  2268.   /*******************************************************************************
  2269. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  2270.    *
  2271.    *            Copyright (c) 1988-1992 USENET Community Trust
  2272.    *            Copyright (c) 1986,1987 Dave Taylor
  2273. --- 1,8 ----
  2274.   
  2275. ! static char rcsid[] = "@(#)$Id: utils.c,v 5.12 1993/08/23 03:26:24 syd Exp $";
  2276.   
  2277.   /*******************************************************************************
  2278. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  2279.    *
  2280.    *            Copyright (c) 1988-1992 USENET Community Trust
  2281.    *            Copyright (c) 1986,1987 Dave Taylor
  2282. ***************
  2283. *** 14,19 ****
  2284. --- 14,36 ----
  2285.    *
  2286.    *******************************************************************************
  2287.    * $Log: utils.c,v $
  2288. +  * Revision 5.12  1993/08/23  03:26:24  syd
  2289. +  * Try setting group id separate from user id in chown to
  2290. +  * allow restricted systems to change group id of file
  2291. +  * From: Syd
  2292. +  *
  2293. +  * Revision 5.11  1993/08/03  19:28:39  syd
  2294. +  * Elm tries to replace the system toupper() and tolower() on current
  2295. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2296. +  * collide during linking with routines in isctype.o.  This patch adds
  2297. +  * a Configure test to determine whether replacements are really needed
  2298. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2299. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2300. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2301. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2302. +  * were dropped.
  2303. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2304. +  *
  2305.    * Revision 5.10  1993/04/12  03:11:50  syd
  2306.    * nameof() didn't check that the character after the common string was /, thus
  2307.    * (if Mail is the folderdir) Maildir/x was made to be =dir/x.
  2308. ***************
  2309. *** 69,81 ****
  2310.   #include "headers.h"
  2311.   #include "s_elm.h"
  2312.   #include <sys/stat.h>
  2313. - #include <ctype.h>
  2314.   #include <errno.h>
  2315.   
  2316. - #ifdef BSD
  2317. - #undef tolower
  2318. - #endif
  2319.   extern int errno;
  2320.   
  2321.   create_new_folders()
  2322. --- 86,93 ----
  2323. ***************
  2324. *** 95,101 ****
  2325.       (void) system_call(com, 0);
  2326.   #endif /* MKDIR */
  2327.   
  2328. !     chown(folders, userid, groupid);
  2329.   }
  2330.   
  2331.   create_new_elmdir()
  2332. --- 107,114 ----
  2333.       (void) system_call(com, 0);
  2334.   #endif /* MKDIR */
  2335.   
  2336. !     chown(folders, -1, groupid);
  2337. !     chown(folders, userid, -1);
  2338.   }
  2339.   
  2340.   create_new_elmdir()
  2341. ***************
  2342. *** 118,124 ****
  2343.       (void) system_call(com, 0);
  2344.   #endif /* MKDIR */
  2345.   
  2346. !     chown( source, userid, groupid);
  2347.   }
  2348.   
  2349.   move_old_files_to_new()
  2350. --- 131,138 ----
  2351.       (void) system_call(com, 0);
  2352.   #endif /* MKDIR */
  2353.   
  2354. !     chown( source, -1, groupid);
  2355. !     chown( source, userid, -1);
  2356.   }
  2357.   
  2358.   move_old_files_to_new()
  2359.  
  2360. Index: src/wordwrap.c
  2361. Prereq: 5.4
  2362. *** ../elm2.4/src/wordwrap.c    Sun Apr 11 23:02:40 1993
  2363. --- src/wordwrap.c    Tue Aug  3 15:29:25 1993
  2364. ***************
  2365. *** 1,5 ****
  2366.   /*******************************************************************************
  2367. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  2368.    *
  2369.    *            Copyright (c) 1988-1992 USENET Community Trust
  2370.    *            Copyright (c) 1986,1987 Dave Taylor
  2371. --- 1,8 ----
  2372. + static char rcsid[] = "@(#)$Id: wordwrap.c,v 5.6 1993/08/03 19:28:39 syd Exp $";
  2373.   /*******************************************************************************
  2374. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  2375.    *
  2376.    *            Copyright (c) 1988-1992 USENET Community Trust
  2377.    *            Copyright (c) 1986,1987 Dave Taylor
  2378. ***************
  2379. *** 11,16 ****
  2380. --- 14,35 ----
  2381.    *
  2382.    *******************************************************************************
  2383.    * $Log: wordwrap.c,v $
  2384. +  * Revision 5.6  1993/08/03  19:28:39  syd
  2385. +  * Elm tries to replace the system toupper() and tolower() on current
  2386. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2387. +  * collide during linking with routines in isctype.o.  This patch adds
  2388. +  * a Configure test to determine whether replacements are really needed
  2389. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2390. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2391. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2392. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2393. +  * were dropped.
  2394. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2395. +  *
  2396. +  * Revision 5.5  1993/06/10  03:12:10  syd
  2397. +  * Add missing rcs id lines
  2398. +  * From: Syd
  2399. +  *
  2400.    * Revision 5.4  1993/04/12  03:02:40  syd
  2401.    * Check for EINTR if getchar() returns EOF. Happens after a resume from an
  2402.    * interactive stop.
  2403. ***************
  2404. *** 42,52 ****
  2405.   
  2406.   #include "headers.h"
  2407.   #include <errno.h>
  2408. - #include <ctype.h>
  2409. - #ifdef BSD
  2410. - #  undef tolower
  2411. - #endif
  2412.   
  2413.   extern int errno;        /* system error number */
  2414.   
  2415. --- 61,66 ----
  2416.  
  2417. Index: utils/answer.c
  2418. Prereq: 5.5
  2419. *** ../elm2.4/utils/answer.c    Thu Feb  4 10:32:52 1993
  2420. --- utils/answer.c    Tue Aug 10 14:54:15 1993
  2421. ***************
  2422. *** 1,8 ****
  2423.   
  2424. ! static char rcsid[] = "@(#)$Id: answer.c,v 5.5 1993/02/04 15:32:52 syd Exp $";
  2425.   
  2426.   /*******************************************************************************
  2427. !  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  2428.    *
  2429.    *             Copyright (c) 1988-1992 USENET Community Trust
  2430.    *             Copyright (c) 1986,1987 Dave Taylor
  2431. --- 1,8 ----
  2432.   
  2433. ! static char rcsid[] = "@(#)$Id: answer.c,v 5.7 1993/08/10 18:54:13 syd Exp $";
  2434.   
  2435.   /*******************************************************************************
  2436. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  2437.    *
  2438.    *             Copyright (c) 1988-1992 USENET Community Trust
  2439.    *             Copyright (c) 1986,1987 Dave Taylor
  2440. ***************
  2441. *** 14,19 ****
  2442. --- 14,35 ----
  2443.    *
  2444.    *******************************************************************************
  2445.    * $Log: answer.c,v $
  2446. +  * Revision 5.7  1993/08/10  18:54:13  syd
  2447. +  * A change to answer:s mail command to be like those of elm and filter.
  2448. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  2449. +  *
  2450. +  * Revision 5.6  1993/08/03  19:28:39  syd
  2451. +  * Elm tries to replace the system toupper() and tolower() on current
  2452. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2453. +  * collide during linking with routines in isctype.o.  This patch adds
  2454. +  * a Configure test to determine whether replacements are really needed
  2455. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2456. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2457. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2458. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2459. +  * were dropped.
  2460. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2461. +  *
  2462.    * Revision 5.5  1993/02/04  15:32:52  syd
  2463.    * Add cast to silence compiler warning.
  2464.    * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2465. ***************
  2466. *** 50,60 ****
  2467.   #include "ndbz.h"
  2468.   #include "s_answer.h"
  2469.   #include "sysdefs.h"
  2470. - #include <ctype.h>
  2471. - #ifdef BSD
  2472. - #undef        tolower
  2473. - #endif
  2474.   
  2475.   #define  ELM        "elm"        /* where the elm program lives */
  2476.   
  2477. --- 66,71 ----
  2478. ***************
  2479. *** 250,257 ****
  2480.         fclose(fd);
  2481.    
  2482.         sprintf(buffer, catgets(elm_msg_cat, AnswerSet, AnswerElmCommand,
  2483. !          "( ( %s -s \"While You Were Out\" %s ; %s %s) & ) < %s > /dev/null"),
  2484. !          ELM, strip_parens(address), remove_cmd, tempfile, tempfile);
  2485.   
  2486.         system(buffer);
  2487.       }
  2488. --- 261,268 ----
  2489.         fclose(fd);
  2490.    
  2491.         sprintf(buffer, catgets(elm_msg_cat, AnswerSet, AnswerElmCommand,
  2492. !          "( ( %s -s \"While You Were Out\" %s < %s ; %s %s) & ) > /dev/null"),
  2493. !          ELM, strip_parens(address), tempfile, remove_cmd, tempfile);
  2494.   
  2495.         system(buffer);
  2496.       }
  2497. ***************
  2498. *** 270,277 ****
  2499.   
  2500.       for (i=0, len = strlen(fullname); i < len; i++) {
  2501.   
  2502. !       if (isupper(fullname[i]))
  2503. !          fullname[i] = tolower(fullname[i]);
  2504.   
  2505.         if (fullname[i] == ' ') 
  2506.           if (lastname) {
  2507. --- 281,287 ----
  2508.   
  2509.       for (i=0, len = strlen(fullname); i < len; i++) {
  2510.   
  2511. !       fullname[i] = tolower(fullname[i]);
  2512.   
  2513.         if (fullname[i] == ' ') 
  2514.           if (lastname) {
  2515.  
  2516. Index: utils/arepdaem.c
  2517. Prereq: 5.12
  2518. *** ../elm2.4/utils/arepdaem.c    Mon May 31 15:39:25 1993
  2519. --- utils/arepdaem.c    Tue Aug  3 15:29:26 1993
  2520. ***************
  2521. *** 1,8 ****
  2522.   
  2523. ! static char rcsid[] = "@(#)$Id: arepdaem.c,v 5.12 1993/05/31 19:39:24 syd Exp $";
  2524.   
  2525.   /*******************************************************************************
  2526. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  2527.    *
  2528.    *             Copyright (c) 1988-1992 USENET Community Trust
  2529.    *             Copyright (c) 1986,1987 Dave Taylor
  2530. --- 1,8 ----
  2531.   
  2532. ! static char rcsid[] = "@(#)$Id: arepdaem.c,v 5.13 1993/08/03 19:28:39 syd Exp $";
  2533.   
  2534.   /*******************************************************************************
  2535. !  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
  2536.    *
  2537.    *             Copyright (c) 1988-1992 USENET Community Trust
  2538.    *             Copyright (c) 1986,1987 Dave Taylor
  2539. ***************
  2540. *** 14,19 ****
  2541. --- 14,31 ----
  2542.    *
  2543.    *******************************************************************************
  2544.    * $Log: arepdaem.c,v $
  2545. +  * Revision 5.13  1993/08/03  19:28:39  syd
  2546. +  * Elm tries to replace the system toupper() and tolower() on current
  2547. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2548. +  * collide during linking with routines in isctype.o.  This patch adds
  2549. +  * a Configure test to determine whether replacements are really needed
  2550. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2551. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2552. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2553. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2554. +  * were dropped.
  2555. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2556. +  *
  2557.    * Revision 5.12  1993/05/31  19:39:24  syd
  2558.    * check for missing replyfile
  2559.    * From: roy@lorien.gatech.edu (Roy Mongiovi)
  2560. ***************
  2561. *** 107,113 ****
  2562.   #endif
  2563.   
  2564.   #include <sys/stat.h>
  2565. - #include <ctype.h>
  2566.   #include <errno.h>
  2567.   
  2568.   #define arep_lock_file    "LCK..arep"
  2569. --- 119,124 ----
  2570.  
  2571. Index: utils/elmalias.c
  2572. Prereq: 5.2
  2573. *** ../elm2.4/utils/elmalias.c    Sun May 16 16:55:32 1993
  2574. --- utils/elmalias.c    Sun Aug 22 22:44:41 1993
  2575. ***************
  2576. *** 1,8 ****
  2577.   
  2578. ! static char rcsid[] = "@(#)$Id: elmalias.c,v 5.2 1993/05/16 20:55:32 syd Exp $";
  2579.   
  2580.   /*******************************************************************************
  2581. !  *  The Elm Mail System  -  $Revision: 5.2 $
  2582.    *
  2583.    *             Copyright (c) 1988-1992 USENET Community Trust
  2584.    *             Copyright (c) 1986,1987 Dave Taylor
  2585. --- 1,8 ----
  2586.   
  2587. ! static char rcsid[] = "@(#)$Id: elmalias.c,v 5.6 1993/08/23 02:44:41 syd Exp $";
  2588.   
  2589.   /*******************************************************************************
  2590. !  *  The Elm Mail System  -  $Revision: 5.6 $
  2591.    *
  2592.    *             Copyright (c) 1988-1992 USENET Community Trust
  2593.    *             Copyright (c) 1986,1987 Dave Taylor
  2594. ***************
  2595. *** 14,19 ****
  2596. --- 14,35 ----
  2597.    *
  2598.    *******************************************************************************
  2599.    * $Log: elmalias.c,v $
  2600. +  * Revision 5.6  1993/08/23  02:44:41  syd
  2601. +  * fix where checkalias doesn't fully expand multi-database aliases
  2602. +  * From: Steve Wolf <woof@atl.hp.com>
  2603. +  *
  2604. +  * Revision 5.5  1993/08/03  19:23:25  syd
  2605. +  * Added -d option to elmalias.
  2606. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  2607. +  *
  2608. +  * Revision 5.4  1993/07/27  20:27:33  syd
  2609. +  * fix strchr, Elm uses define to make index strchr when needed
  2610. +  * From: Syd
  2611. +  *
  2612. +  * Revision 5.3  1993/07/20  02:59:53  syd
  2613. +  * Support aliases both on 64 bit and 32 bit machines at the same time.
  2614. +  * From: Dan Mosedale <mosedale@genome.stanford.edu>
  2615. +  *
  2616.    * Revision 5.2  1993/05/16  20:55:32  syd
  2617.    * fix elmalias bug
  2618.    * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2619. ***************
  2620. *** 60,69 ****
  2621.    *    alias chip is address "chip@chinacat.unicom.com" (Chip Rosenthal)
  2622.    *
  2623.    * Synopsis:
  2624. !  *    elmalias [-aensuvV] [-f format] [alias ...]
  2625.    *
  2626.    * Options:
  2627.    *    -a    Display alias name.  Equivalent to -f "%-20.20a %v".
  2628.    *    -e    Fully expand alias values.
  2629.    *    -f fmt    User-specified output format.
  2630.    *    -n    Display name.  Equivalent to -f "%v?n (%n)?".
  2631. --- 76,86 ----
  2632.    *    alias chip is address "chip@chinacat.unicom.com" (Chip Rosenthal)
  2633.    *
  2634.    * Synopsis:
  2635. !  *    elmalias [-adensuvV] [-f format] [alias ...]
  2636.    *
  2637.    * Options:
  2638.    *    -a    Display alias name.  Equivalent to -f "%-20.20a %v".
  2639. +  *    -d    Turn debugging on. Only useful if DEBUG is defined.
  2640.    *    -e    Fully expand alias values.
  2641.    *    -f fmt    User-specified output format.
  2642.    *    -n    Display name.  Equivalent to -f "%v?n (%n)?".
  2643. ***************
  2644. *** 114,120 ****
  2645.   void usage_error()
  2646.   {
  2647.       fprintf(stderr, catgets(elm_msg_cat, ElmaliasSet, ElmaliasUsage,
  2648. !     "usage: %s [-aenrsuvV] [-f format] [alias ...]\n"), Progname);
  2649.       exit(1);
  2650.       /*NOTREACHED*/
  2651.   }
  2652. --- 131,137 ----
  2653.   void usage_error()
  2654.   {
  2655.       fprintf(stderr, catgets(elm_msg_cat, ElmaliasSet, ElmaliasUsage,
  2656. !     "usage: %s [-adenrsuvV] [-f format] [alias ...]\n"), Progname);
  2657.       exit(1);
  2658.       /*NOTREACHED*/
  2659.   }
  2660. ***************
  2661. *** 168,178 ****
  2662.       /*
  2663.        * Crack command line options.
  2664.        */
  2665. !     while ((i = getopt(argc, argv, "aef:nrsuvV")) != EOF) {
  2666.       switch (i) {
  2667.       case 'a':            /* show alias name and value    */
  2668.           out_fmt = "%-20.20a %v";
  2669.           break;
  2670.       case 'e':            /* recursively expand aliases    */
  2671.           do_expand = TRUE;
  2672.           break;
  2673. --- 185,200 ----
  2674.       /*
  2675.        * Crack command line options.
  2676.        */
  2677. !     while ((i = getopt(argc, argv, "adef:nrsuvV")) != EOF) {
  2678.       switch (i) {
  2679.       case 'a':            /* show alias name and value    */
  2680.           out_fmt = "%-20.20a %v";
  2681.           break;
  2682. +     case 'd':
  2683. + #ifdef DEBUG
  2684. +         debug = 10;
  2685. + #endif
  2686. +         break;
  2687.       case 'e':            /* recursively expand aliases    */
  2688.           do_expand = TRUE;
  2689.           break;
  2690. ***************
  2691. *** 273,279 ****
  2692.           ar = make_dummy_rec(argv[i]);
  2693.           print_alias(out_fmt, ar);
  2694.       } else if (do_expand && (ar->type & GROUP)) {
  2695. !         exp_print_alias(dblist[d], out_fmt, ar);
  2696.       } else {
  2697.           print_alias(out_fmt, ar);
  2698.       }
  2699. --- 295,301 ----
  2700.           ar = make_dummy_rec(argv[i]);
  2701.           print_alias(out_fmt, ar);
  2702.       } else if (do_expand && (ar->type & GROUP)) {
  2703. !         exp_print_alias(dblist, out_fmt, ar);
  2704.       } else {
  2705.           print_alias(out_fmt, ar);
  2706.       }
  2707. ***************
  2708. *** 336,343 ****
  2709.   /*
  2710.    * Recursively expand out a list of addresses and print the expansions.
  2711.    */
  2712. ! void exp_print_alias(db, fmt, ar)
  2713. ! DBZ *db;
  2714.   char *fmt;
  2715.   struct alias_rec *ar;
  2716.   {
  2717. --- 358,365 ----
  2718.   /*
  2719.    * Recursively expand out a list of addresses and print the expansions.
  2720.    */
  2721. ! void exp_print_alias(dblist, fmt, ar)
  2722. ! DBZ *dblist[];
  2723.   char *fmt;
  2724.   struct alias_rec *ar;
  2725.   {
  2726. ***************
  2727. *** 345,350 ****
  2728. --- 367,373 ----
  2729.       char *acurr;    /* pointer to current address within "abuf"    */
  2730.       char *anext;    /* pointer to next address within "abuf"    */
  2731.       struct alias_rec *ar0;
  2732. +     int d;        /* dblist index                    */
  2733.   
  2734.       /*
  2735.        * Create a copy of this address we can scribble upon.
  2736. ***************
  2737. *** 358,367 ****
  2738.        * Go through all of the addresses and expand them out.
  2739.        */
  2740.       while ((acurr = next_addr_in_list(&anext)) != NULL) {
  2741. !     if ((ar0 = fetch_alias(db, acurr)) == NULL)
  2742.           ar0 = make_dummy_rec(acurr);
  2743.       if (ar0->type & GROUP)
  2744. !         exp_print_alias(db, fmt, ar0);
  2745.       else
  2746.           print_alias(fmt, ar0);
  2747.       (void) free((malloc_t)ar0);
  2748. --- 381,394 ----
  2749.        * Go through all of the addresses and expand them out.
  2750.        */
  2751.       while ((acurr = next_addr_in_list(&anext)) != NULL) {
  2752. !     for (d = 0 ; dblist[d] != NULL ; ++d) {
  2753. !         if ((ar0 = fetch_alias(dblist[d], acurr)) != NULL)
  2754. !         break;
  2755. !     }
  2756. !     if (ar0 == NULL)
  2757.           ar0 = make_dummy_rec(acurr);
  2758.       if (ar0->type & GROUP)
  2759. !         exp_print_alias(dblist, fmt, ar0);
  2760.       else
  2761.           print_alias(fmt, ar0);
  2762.       (void) free((malloc_t)ar0);
  2763. ***************
  2764. *** 401,407 ****
  2765.            */
  2766.           pfmt[0] = *fmt++;
  2767.           n = 1;
  2768. !         while (strchr("-.0123456789", *fmt) != NULL) {
  2769.           if (n < sizeof(pfmt)-2)
  2770.               pfmt[n++] = *fmt;
  2771.           ++fmt;
  2772. --- 428,434 ----
  2773.            */
  2774.           pfmt[0] = *fmt++;
  2775.           n = 1;
  2776. !         while (index("-.0123456789", *fmt) != NULL) {
  2777.           if (n < sizeof(pfmt)-2)
  2778.               pfmt[n++] = *fmt;
  2779.           ++fmt;
  2780.  
  2781. Index: utils/fastmail.c
  2782. Prereq: 5.7
  2783. *** ../elm2.4/utils/fastmail.c    Sun Jun  6 14:32:10 1993
  2784. --- utils/fastmail.c    Mon Jul 19 22:46:37 1993
  2785. ***************
  2786. *** 1,8 ****
  2787.   
  2788. ! static char rcsid[] = "@(#)$Id: fastmail.c,v 5.7 1993/06/06 18:31:43 syd Exp $";
  2789.   
  2790.   /*******************************************************************************
  2791. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  2792.    *
  2793.    *             Copyright (c) 1988-1992 USENET Community Trust
  2794.    *             Copyright (c) 1986,1987 Dave Taylor
  2795. --- 1,8 ----
  2796.   
  2797. ! static char rcsid[] = "@(#)$Id: fastmail.c,v 5.8 1993/07/20 02:46:36 syd Exp $";
  2798.   
  2799.   /*******************************************************************************
  2800. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  2801.    *
  2802.    *             Copyright (c) 1988-1992 USENET Community Trust
  2803.    *             Copyright (c) 1986,1987 Dave Taylor
  2804. ***************
  2805. *** 14,19 ****
  2806. --- 14,24 ----
  2807.    *
  2808.    *******************************************************************************
  2809.    * $Log: fastmail.c,v $
  2810. +  * Revision 5.8  1993/07/20  02:46:36  syd
  2811. +  * In fastmail, if environment variable $REPLYTO is set, use it as
  2812. +  * default Reply-To.  Also, eliminate unnecessary strlen() calls.
  2813. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  2814. +  *
  2815.    * Revision 5.7  1993/06/06  18:31:43  syd
  2816.    * fix typo
  2817.    *
  2818. ***************
  2819. *** 99,105 ****
  2820.       char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
  2821.       char from_addr[SLEN], comments[SLEN], inreplyto[NLEN];
  2822.       char references[SLEN];
  2823. !     char *tmplogname;
  2824.       int  c, sendmail_available, debug = 0;
  2825.   
  2826.       elm_msg_cat = catopen("elm2.4", 0);
  2827. --- 104,110 ----
  2828.       char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
  2829.       char from_addr[SLEN], comments[SLEN], inreplyto[NLEN];
  2830.       char references[SLEN];
  2831. !     char *p;
  2832.       int  c, sendmail_available, debug = 0;
  2833.   
  2834.       elm_msg_cat = catopen("elm2.4", 0);
  2835. ***************
  2836. *** 115,120 ****
  2837. --- 120,128 ----
  2838.       inreplyto[0] = '\0';
  2839.       references[0] = '\0';
  2840.   
  2841. +     if ((p = getenv("REPLYTO")) != NULL)
  2842. +       strcpy(replyto, p);
  2843.       while ((c = getopt(argc, argv, "b:c:C:df:F:i:r:R:s:")) != EOF) {
  2844.         switch (c) {
  2845.           case 'b' : strcpy(bcc_list, optarg);        break;
  2846. ***************
  2847. *** 147,159 ****
  2848.       gethostname(hostname, sizeof(hostname));
  2849.   #endif
  2850.   
  2851. !     tmplogname = getlogin();
  2852. !     if (tmplogname != NULL)
  2853. !       strcpy(username, tmplogname);
  2854. !     else
  2855. !       username[0] = '\0';
  2856. !     if (strlen(username) == 0)
  2857.         cuserid(username);
  2858.   
  2859.       if (strcmp(filename, "-")) {
  2860. --- 155,164 ----
  2861.       gethostname(hostname, sizeof(hostname));
  2862.   #endif
  2863.   
  2864. !     username[0] = '\0';
  2865. !     if ((p = getlogin()) != NULL)
  2866. !       strcpy(username, p);
  2867. !     if (!username[0])
  2868.         cuserid(username);
  2869.   
  2870.       if (strcmp(filename, "-")) {
  2871. ***************
  2872. *** 213,237 ****
  2873.   
  2874.       fprintf(tempfile, "Date: %s\n", get_arpa_date());
  2875.   
  2876. !     if (strlen(replyto) > 0)
  2877.         fprintf(tempfile, "Reply-To: %s\n", replyto);
  2878.   
  2879. !     while (optind < argc) 
  2880. !           sprintf(to_list, "%s%s%s", to_list, (strlen(to_list) > 0? ",":""), 
  2881. !           argv[optind++]);
  2882.       
  2883.       fprintf(tempfile, "To: %s\n", to_list);
  2884.   
  2885. !     if (strlen(cc_list) > 0)
  2886.         fprintf(tempfile, "Cc: %s\n", cc_list);
  2887.   
  2888. !     if (strlen(references) > 0)
  2889.         fprintf(tempfile, "References: %s\n", references);
  2890.   
  2891. !     if (strlen(inreplyto) > 0)
  2892.         fprintf(tempfile, "In-Reply-To: %s\n", inreplyto);
  2893.   
  2894. !     if (strlen(comments) > 0)
  2895.         fprintf(tempfile, "Comments: %s\n", comments);
  2896.   
  2897.   #ifndef NO_XHEADER
  2898. --- 218,244 ----
  2899.   
  2900.       fprintf(tempfile, "Date: %s\n", get_arpa_date());
  2901.   
  2902. !     if (replyto[0])
  2903.         fprintf(tempfile, "Reply-To: %s\n", replyto);
  2904.   
  2905. !     while (optind < argc) {
  2906. !       if (to_list[0])
  2907. !         strcat(to_list, ",");
  2908. !       strcat(to_list, argv[optind++]);
  2909. !     }
  2910.       
  2911.       fprintf(tempfile, "To: %s\n", to_list);
  2912.   
  2913. !     if (cc_list[0])
  2914.         fprintf(tempfile, "Cc: %s\n", cc_list);
  2915.   
  2916. !     if (references[0])
  2917.         fprintf(tempfile, "References: %s\n", references);
  2918.   
  2919. !     if (inreplyto[0])
  2920.         fprintf(tempfile, "In-Reply-To: %s\n", inreplyto);
  2921.   
  2922. !     if (comments[0])
  2923.         fprintf(tempfile, "Comments: %s\n", comments);
  2924.   
  2925.   #ifndef NO_XHEADER
  2926. ***************
  2927. *** 248,255 ****
  2928.   
  2929.       if (debug)
  2930.           printf("Mailing to %s%s%s%s%s [via %s]\n", to_list,
  2931. !             (strlen(cc_list) > 0 ? " ":""), cc_list,
  2932. !             (strlen(bcc_list) > 0 ? " ":""), bcc_list,
  2933.               sendmail_available? "sendmail" : "rmail");
  2934.   
  2935.       sprintf(command_buffer, "cat %s %s | %s %s %s %s", 
  2936. --- 255,262 ----
  2937.   
  2938.       if (debug)
  2939.           printf("Mailing to %s%s%s%s%s [via %s]\n", to_list,
  2940. !             (cc_list[0] ? " ":""), cc_list,
  2941. !             (bcc_list[0] ? " ":""), bcc_list,
  2942.               sendmail_available? "sendmail" : "rmail");
  2943.   
  2944.       sprintf(command_buffer, "cat %s %s | %s %s %s %s", 
  2945.  
  2946. Index: utils/newmail.c
  2947. Prereq: 5.18
  2948. *** ../elm2.4/utils/newmail.c    Sun Jun  6 14:24:48 1993
  2949. --- utils/newmail.c    Tue Aug  3 15:29:27 1993
  2950. ***************
  2951. *** 1,8 ****
  2952.   
  2953. ! static char rcsid[] = "@(#)$Id: newmail.c,v 5.18 1993/06/06 18:00:10 syd Exp $";
  2954.   
  2955.   /*******************************************************************************
  2956. !  *  The Elm Mail System  -  $Revision: 5.18 $   $State: Exp $
  2957.    *
  2958.    *             Copyright (c) 1988-1992 USENET Community Trust
  2959.    *             Copyright (c) 1986,1987 Dave Taylor
  2960. --- 1,8 ----
  2961.   
  2962. ! static char rcsid[] = "@(#)$Id: newmail.c,v 5.19 1993/08/03 19:28:39 syd Exp $";
  2963.   
  2964.   /*******************************************************************************
  2965. !  *  The Elm Mail System  -  $Revision: 5.19 $   $State: Exp $
  2966.    *
  2967.    *             Copyright (c) 1988-1992 USENET Community Trust
  2968.    *             Copyright (c) 1986,1987 Dave Taylor
  2969. ***************
  2970. *** 14,19 ****
  2971. --- 14,31 ----
  2972.    *
  2973.    *******************************************************************************
  2974.    * $Log: newmail.c,v $
  2975. +  * Revision 5.19  1993/08/03  19:28:39  syd
  2976. +  * Elm tries to replace the system toupper() and tolower() on current
  2977. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2978. +  * collide during linking with routines in isctype.o.  This patch adds
  2979. +  * a Configure test to determine whether replacements are really needed
  2980. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2981. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2982. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2983. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2984. +  * were dropped.
  2985. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2986. +  *
  2987.    * Revision 5.18  1993/06/06  18:00:10  syd
  2988.    * Fix max folder check, off by one
  2989.    *
  2990. ***************
  2991. *** 143,149 ****
  2992.   **/
  2993.   
  2994.   #include "elmutil.h"
  2995. - #include <ctype.h>
  2996.   #include "s_newmail.h"
  2997.   
  2998.   #ifdef PWDINSYS
  2999. --- 155,160 ----
  3000.  
  3001. Index: utils/prlong.c
  3002. Prereq: 5.2
  3003. *** ../elm2.4/utils/prlong.c    Tue Apr 20 21:41:19 1993
  3004. --- utils/prlong.c    Tue Aug  3 15:29:28 1993
  3005. ***************
  3006. *** 1,8 ****
  3007.   
  3008. ! static char rcsid[] = "@(#)$Id: prlong.c,v 5.2 1993/04/21 01:41:14 syd Exp $";
  3009.   
  3010.   /*******************************************************************************
  3011. !  *  The Elm Mail System  -  $Revision: 5.2 $
  3012.    *
  3013.    *             Copyright (c) 1988-1992 USENET Community Trust
  3014.    *             Copyright (c) 1986,1987 Dave Taylor
  3015. --- 1,8 ----
  3016.   
  3017. ! static char rcsid[] = "@(#)$Id: prlong.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
  3018.   
  3019.   /*******************************************************************************
  3020. !  *  The Elm Mail System  -  $Revision: 5.3 $
  3021.    *
  3022.    *             Copyright (c) 1988-1992 USENET Community Trust
  3023.    *             Copyright (c) 1986,1987 Dave Taylor
  3024. ***************
  3025. *** 14,19 ****
  3026. --- 14,31 ----
  3027.    *
  3028.    *******************************************************************************
  3029.    * $Log: prlong.c,v $
  3030. +  * Revision 5.3  1993/08/03  19:28:39  syd
  3031. +  * Elm tries to replace the system toupper() and tolower() on current
  3032. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  3033. +  * collide during linking with routines in isctype.o.  This patch adds
  3034. +  * a Configure test to determine whether replacements are really needed
  3035. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  3036. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  3037. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  3038. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  3039. +  * were dropped.
  3040. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  3041. +  *
  3042.    * Revision 5.2  1993/04/21  01:41:14  syd
  3043.    * Needs ctype.h
  3044.    * From: Syd
  3045. ***************
  3046. *** 61,67 ****
  3047.   
  3048.   
  3049.   #include <stdio.h>
  3050. - #include <ctype.h>
  3051.   #include "defs.h"
  3052.   
  3053.   #define MAXWID        78    /* default maximum line width        */
  3054. --- 73,78 ----
  3055.  
  3056. Index: utils/readmsg.c
  3057. Prereq: 5.9
  3058. *** ../elm2.4/utils/readmsg.c    Tue Apr 20 21:17:52 1993
  3059. --- utils/readmsg.c    Tue Aug  3 15:29:29 1993
  3060. ***************
  3061. *** 1,8 ****
  3062.   
  3063. ! static char rcsid[] = "@(#)$Id: readmsg.c,v 5.9 1993/04/21 01:17:51 syd Exp $";
  3064.   
  3065.   /*******************************************************************************
  3066. !  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
  3067.    *
  3068.    *            Copyright (c) 1988-1992 USENET Community Trust
  3069.    *            Copyright (c) 1986,1987 Dave Taylor
  3070. --- 1,8 ----
  3071.   
  3072. ! static char rcsid[] = "@(#)$Id: readmsg.c,v 5.10 1993/08/03 19:28:39 syd Exp $";
  3073.   
  3074.   /*******************************************************************************
  3075. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  3076.    *
  3077.    *            Copyright (c) 1988-1992 USENET Community Trust
  3078.    *            Copyright (c) 1986,1987 Dave Taylor
  3079. ***************
  3080. *** 14,19 ****
  3081. --- 14,31 ----
  3082.    *
  3083.    *******************************************************************************
  3084.    * $Log: readmsg.c,v $
  3085. +  * Revision 5.10  1993/08/03  19:28:39  syd
  3086. +  * Elm tries to replace the system toupper() and tolower() on current
  3087. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  3088. +  * collide during linking with routines in isctype.o.  This patch adds
  3089. +  * a Configure test to determine whether replacements are really needed
  3090. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  3091. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  3092. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  3093. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  3094. +  * were dropped.
  3095. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  3096. +  *
  3097.    * Revision 5.9  1993/04/21  01:17:51  syd
  3098.    * readmsg treated a line with From_ preceeded by whitespace as a valid
  3099.    * message delimiter.
  3100. ***************
  3101. *** 115,121 ****
  3102.   
  3103.   #include "elmutil.h"
  3104.   #include "s_readmsg.h"
  3105. - #include <ctype.h>
  3106.   
  3107.   /** three defines for what level of headers to display **/
  3108.   #define ALL        1
  3109. --- 127,132 ----
  3110.  
  3111.